title | author | description | keywords | dev_langs | |
---|---|---|---|---|---|
Key Down Trigger Behavior |
XAML-Knight |
Add a new behavior that listens to a key press event on the associated UIElement and triggers the set of actions. |
windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, textbox, behaviors, interactivity, KeyDownTrigger, key down trigger |
|
Add a new behavior that listens to a key press event on the associated UIElement and triggers the set of actions.
Platform APIs:
Behaviors
[!div class="nextstepaction"] Try it in the sample app
In this example setting up the KeyDownTriggerBehavior
to start the animation:
<TextBox
PlaceholderText="Set the focus to this TextBox and press enter to trigger the animation"
Width="500">
<interactivity:Interaction.Behaviors>
<behaviors:KeyDownTriggerBehavior
Key="Enter">
<behaviors:StartAnimationAction Animation="{Binding ElementName=MoveAnimation}" />
</behaviors:KeyDownTriggerBehavior>
</interactivity:Interaction.Behaviors>
</TextBox>
Key Down Trigger behavior sample page Source. You can see this in action in Windows Community Toolkit Sample App.