VDT.Core.Blazor.GlobalEventHandler
1.1.4
See the version list below for details.
dotnet add package VDT.Core.Blazor.GlobalEventHandler --version 1.1.4
NuGet\Install-Package VDT.Core.Blazor.GlobalEventHandler -Version 1.1.4
<PackageReference Include="VDT.Core.Blazor.GlobalEventHandler" Version="1.1.4" />
paket add VDT.Core.Blazor.GlobalEventHandler --version 1.1.4
#r "nuget: VDT.Core.Blazor.GlobalEventHandler, 1.1.4"
// Install VDT.Core.Blazor.GlobalEventHandler as a Cake Addin #addin nuget:?package=VDT.Core.Blazor.GlobalEventHandler&version=1.1.4 // Install VDT.Core.Blazor.GlobalEventHandler as a Cake Tool #tool nuget:?package=VDT.Core.Blazor.GlobalEventHandler&version=1.1.4
VDT.Core.Blazor.GlobalEventHandler
Blazor component that allows you to handle global window level events in your application.
Features
- Window-level keyboard events that don't require focus on any element
Usage
To register event handlers, simply include the GlobalEventHandler component on your page and register your event handler with the event in the component that you want to handle. The available events are:
OnKeyDown
which provides an optionalKeyboardEventArgs
parameterOnKeyUp
which provides an optionalKeyboardEventArgs
parameterOnResize
which provides an optionalResizeEventArgs
parameterOnClick
which provides an optionalMouseEventArgs
parameterOnMouseDown
which provides an optionalMouseEventArgs
parameterOnMouseUp
which provides an optionalMouseEventArgs
parameterOnMouseMove
which provides an optionalMouseEventArgs
parameterOnContextMenu
which provides an optionalMouseEventArgs
parameterOnDoubleClick
which provides an optionalMouseEventArgs
parameterOnScroll
which provides an optionalScrollEventArgs
parameter
Example
<GlobalEventHandler OnKeyDown="@OnWindowKeyDown" OnResize="@OnWindowResize" OnClick="@OnWindowClick" />
@if (keyDownEventArgs != null) {
<h2>Last key down event</h2>
<ul>
<li>Alt key: @keyDownEventArgs.AltKey</li>
<li>Code: @keyDownEventArgs.Code</li>
<li>Ctrl key: @keyDownEventArgs.CtrlKey</li>
<li>Key: @keyDownEventArgs.Key</li>
<li>Location: @keyDownEventArgs.Location</li>
<li>Meta key: @keyDownEventArgs.MetaKey</li>
<li>Repeat: @keyDownEventArgs.Repeat</li>
<li>Shift key: @keyDownEventArgs.ShiftKey</li>
<li>Type: @keyDownEventArgs.Type</li>
</ul>
}
@if (resizeEventArgs != null) {
<h2>Last resize event</h2>
<ul>
<li>Width: @resizeEventArgs.Width</li>
<li>Height: @resizeEventArgs.Height</li>
</ul>
}
@if (clicked) {
<h2>Clicked</h2>
}
@code {
private KeyboardEventArgs? keyDownEventArgs;
private ResizeEventArgs? resizeEventArgs;
private bool clicked = false;
// Handlers can be asynchronous ...
public async Task OnWindowKeyDown(KeyboardEventArgs args) {
keyDownEventArgs = args;
await Task.CompletedTask;
}
// ... Or synchronous
public void OnWindowResize(ResizeEventArgs args) {
resizeEventArgs = args;
}
// EventArgs are optional
public void OnWindowClick() {
clicked = true;
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- Microsoft.AspNetCore.Components.Web (>= 5.0.12)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on VDT.Core.Blazor.GlobalEventHandler:
Package | Downloads |
---|---|
VDT.Core.Blazor.DragAndDropList
Blazor component that allows users to reorder items in a list by dragging and dropping |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.2.0 | 576 | 6/14/2024 |
3.1.0 | 113 | 6/1/2024 |
3.0.0 | 164 | 3/19/2024 |
2.2.0 | 252 | 8/17/2023 |
2.1.1 | 354 | 2/27/2023 |
2.1.0 | 245 | 2/23/2023 |
2.0.0 | 243 | 2/13/2023 |
1.2.0 | 266 | 2/12/2023 |
1.1.4 | 261 | 2/11/2023 |
1.1.3 | 260 | 2/3/2023 |
1.1.2 | 359 | 1/15/2022 |
1.1.1 | 269 | 1/15/2022 |
1.1.0 | 1,231 | 11/20/2021 |
1.0.0 | 303 | 11/9/2021 |
- Added example project
- Simplified javascript module
- Added fingerprint to javascript module