Class KeyboardEventDispatchExtensions
- Namespace
- Bunit
- Assembly
- Bunit.Web.dll
Keyboard event dispatch helper extension methods.
public static class KeyboardEventDispatchExtensions
- Inheritance
-
KeyboardEventDispatchExtensions
- Inherited Members
Methods
KeyDown(IElement, Key, bool, string?)
Raises the @onkeydown
event on element
, passing the provided key
to the event handler.
public static void KeyDown(this IElement element, Key key, bool repeat = false, string? type = null)
Parameters
element
IElementThe element to raise the event on.
key
KeyThe keyboard key to pass to the event handler.
repeat
booltrue
if a key has been depressed long enough to trigger key repetition, otherwisefalse
.type
stringThe type of the event.
KeyDown(IElement, KeyboardEventArgs)
Raises the @onkeydown
event on element
, passing the provided eventArgs
to the event handler.
public static void KeyDown(this IElement element, KeyboardEventArgs eventArgs)
Parameters
element
IElementThe element to raise the event on.
eventArgs
KeyboardEventArgsThe event arguments to pass to the event handler.
KeyDown(IElement, string, string?, float, bool, bool, bool, bool, bool, string?)
Raises the @onkeydown
event on element
, passing the provided
properties to the event handler via a KeyboardEventArgs object.
public static void KeyDown(this IElement element, string key, string? code = null, float location = 0, bool repeat = false, bool ctrlKey = false, bool shiftKey = false, bool altKey = false, bool metaKey = false, string? type = null)
Parameters
element
IElementThe element to raise the event on.
key
stringThe key value of the key represented by the event. If the value has a printed representation, this attribute's value is the same as the char attribute. Otherwise, it's one of the key value strings specified in 'Key values'. If the key can't be identified, this is the string "Unidentified".
code
stringHolds a string that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value.
location
floatThe location of the key on the device.
repeat
booltrue if a key has been depressed long enough to trigger key repetition, otherwise false.
ctrlKey
booltrue if the control key was down when the event was fired. false otherwise.
shiftKey
booltrue if the shift key was down when the event was fired. false otherwise.
altKey
booltrue if the alt key was down when the event was fired. false otherwise.
metaKey
booltrue if the meta key was down when the event was fired. false otherwise.
type
stringThe type of the event.
KeyDownAsync(IElement, KeyboardEventArgs)
Raises the @onkeydown
event on element
, passing the provided eventArgs
to the event handler.
public static Task KeyDownAsync(this IElement element, KeyboardEventArgs eventArgs)
Parameters
element
IElementThe element to raise the event on.
eventArgs
KeyboardEventArgsThe event arguments to pass to the event handler.
Returns
- Task
A task that completes when the event handler is done.
KeyPress(IElement, Key, bool, string?)
Raises the @onkeypress
event on element
, passing the provided key
to the event handler.
public static void KeyPress(this IElement element, Key key, bool repeat = false, string? type = null)
Parameters
element
IElementThe element to raise the event on.
key
KeyThe keyboard key to pass to the event handler.
repeat
booltrue
if a key has been depressed long enough to trigger key repetition, otherwisefalse
.type
stringThe type of the event.
KeyPress(IElement, KeyboardEventArgs)
Raises the @onkeypress
event on element
, passing the provided eventArgs
to the event handler.
public static void KeyPress(this IElement element, KeyboardEventArgs eventArgs)
Parameters
element
IElementThe element to raise the event on.
eventArgs
KeyboardEventArgsThe event arguments to pass to the event handler.
KeyPress(IElement, string, string?, float, bool, bool, bool, bool, bool, string?)
Raises the @onkeypress
event on element
, passing the provided
properties to the event handler via a KeyboardEventArgs object.
public static void KeyPress(this IElement element, string key, string? code = null, float location = 0, bool repeat = false, bool ctrlKey = false, bool shiftKey = false, bool altKey = false, bool metaKey = false, string? type = null)
Parameters
element
IElementThe element to raise the event on.
key
stringThe key value of the key represented by the event. If the value has a printed representation, this attribute's value is the same as the char attribute. Otherwise, it's one of the key value strings specified in 'Key values'. If the key can't be identified, this is the string "Unidentified".
code
stringHolds a string that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value.
location
floatThe location of the key on the device.
repeat
booltrue if a key has been depressed long enough to trigger key repetition, otherwise false.
ctrlKey
booltrue if the control key was down when the event was fired. false otherwise.
shiftKey
booltrue if the shift key was down when the event was fired. false otherwise.
altKey
booltrue if the alt key was down when the event was fired. false otherwise.
metaKey
booltrue if the meta key was down when the event was fired. false otherwise.
type
stringThe type of the event.
KeyPressAsync(IElement, KeyboardEventArgs)
Raises the @onkeypress
event on element
, passing the provided eventArgs
to the event handler.
public static Task KeyPressAsync(this IElement element, KeyboardEventArgs eventArgs)
Parameters
element
IElementThe element to raise the event on.
eventArgs
KeyboardEventArgsThe event arguments to pass to the event handler.
Returns
- Task
A task that completes when the event handler is done.
KeyUp(IElement, Key, bool, string?)
Raises the @onkeyup
event on element
, passing the provided key
to the event handler.
public static void KeyUp(this IElement element, Key key, bool repeat = false, string? type = null)
Parameters
element
IElementThe element to raise the event on.
key
KeyThe keyboard key to pass to the event handler.
repeat
booltrue
if a key has been depressed long enough to trigger key repetition, otherwisefalse
.type
stringThe type of the event.
KeyUp(IElement, KeyboardEventArgs)
Raises the @onkeyup
event on element
, passing the provided eventArgs
to the event handler.
public static void KeyUp(this IElement element, KeyboardEventArgs eventArgs)
Parameters
element
IElementThe element to raise the event on.
eventArgs
KeyboardEventArgsThe event arguments to pass to the event handler.
KeyUp(IElement, string, string?, float, bool, bool, bool, bool, bool, string?)
Raises the @onkeyup
event on element
, passing the provided
properties to the event handler via a KeyboardEventArgs object.
public static void KeyUp(this IElement element, string key, string? code = null, float location = 0, bool repeat = false, bool ctrlKey = false, bool shiftKey = false, bool altKey = false, bool metaKey = false, string? type = null)
Parameters
element
IElementThe element to raise the event on.
key
stringThe key value of the key represented by the event. If the value has a printed representation, this attribute's value is the same as the char attribute. Otherwise, it's one of the key value strings specified in 'Key values'. If the key can't be identified, this is the string "Unidentified".
code
stringHolds a string that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value.
location
floatThe location of the key on the device.
repeat
booltrue if a key has been depressed long enough to trigger key repetition, otherwise false.
ctrlKey
booltrue if the control key was down when the event was fired. false otherwise.
shiftKey
booltrue if the shift key was down when the event was fired. false otherwise.
altKey
booltrue if the alt key was down when the event was fired. false otherwise.
metaKey
booltrue if the meta key was down when the event was fired. false otherwise.
type
stringThe type of the event.
KeyUpAsync(IElement, KeyboardEventArgs)
Raises the @onkeyup
event on element
, passing the provided eventArgs
to the event handler.
public static Task KeyUpAsync(this IElement element, KeyboardEventArgs eventArgs)
Parameters
element
IElementThe element to raise the event on.
eventArgs
KeyboardEventArgsThe event arguments to pass to the event handler.
Returns
- Task
A task that completes when the event handler is done.