Occurs when the key is released while the plug-in has focus.
| XAML | object KeyUp="eventhandlerFunction" .../> |
| Scripting |
[token = ]object.AddEventListener("KeyUp", eventhandlerFunction)
|
AddEventListener Parameters
| token | integer A token that is returned from the function, which you can optionally retain as a variable. If you intend to call RemoveEventListener to remove the handler, you will need this token. |
| eventhandlerFunction | object The name of your event handler function as it is defined in script. When used as an AddEventListener parameter, quotes around the function name are not required. See Remarks. |
Event Handler Parameters
| sender | object Identifies the object that invoked the event. |
| keyEventArgs | object keyEventArgs.Key - an integer value that represents the key that is up. This value is the portable Key code, which is not operating system-specific. keyEventArgs.PlatformKeyCode - an integer value that represents the key that is up. This value is the non-portable key code, which is operating system-specific. keyEventArgs.Shift - a Boolean value that determines whether the SHIFT key is down. keyEventArgs.Ctrl - a Boolean value that determines whether the CTRL key is down. |
Examples
The following XAML example shows a KeyUp event defined for the root Canvas object:
| XAML |
<Canvas
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
KeyUp="onKeyUp">
<TextBlock
x:Name="myTextBlock"
Text="Display KeyUp event arguments" />
</Canvas>
|
The following JavaScript example shows how to implement a KeyUp event
handler function. In this case, the Silverlight version is displayed when the
keystroke combination CTRL+V was detected:
| JavaScript |
// Set the TextBlock to display the key values.
function onKeyUp(sender, keyEventArgs)
{
// Determine whether the keystroke combination CTRL+V was detected.
if ((keyEventArgs.key == 51) && (keyEventArgs.ctrl == true))
{
// Retrieve a reference to the plug-in.
var plugin = sender.getHost();
// Display whether the 1.0 version of Silverlight is supported.
alert("Silverlight version: " + plugin.IsVersionSupported);
}
}
|
Applies To
Canvas
See Also
Silverlight Keyboard Support
Silverlight Events
Key
KeyDown