title | author | description | keywords | dev_langs | |
---|---|---|---|---|---|
Focus Behaviors |
michael-hawker |
Behaviors for helping focus controls in different scenarios. |
windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, textbox, behaviors, interactivity, focus, auto focus |
|
The FocusBehavior
and AutoFocusBehavior
help control focus flow within your application.
Platform APIs:
AutoFocusBehavior
,FocusBehavior
[!div class="nextstepaction"] Try it in the sample app
In this example using the AutoFocusBehavior
the button will automatically receive focus when it is loaded:
<Button Content="I receive the focus when loaded">
<interactivity:Interaction.Behaviors>
<behaviors:AutoFocusBehavior />
</interactivity:Interaction.Behaviors>
</Button>
Focus behavior sample page Source. You can see this in action in Windows Community Toolkit Sample App.