Page 1 of 1
WPF Keyboard Navigation - Set element as focused
Posted: 30 Apr 2021, 14:03
by BartekW
Hey, I want to ask how may I set element as focused on start? When I generate view I have to click some times "Right arrow" to have focused any element. Can I set on start for example first element?
Re: WPF Keyboard Navigation - Set element as focused
Posted: 30 Apr 2021, 19:26
by sfernandez
You can use a trigger for Loaded event to set the focus on any element:
<Button Content="Button">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<noesis:SetFocusAction/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
Re: WPF Keyboard Navigation - Set element as focused
Posted: 04 May 2021, 09:42
by BartekW
Yes, thanks that worked :)
Re: WPF Keyboard Navigation - Set element as focused
Posted: 05 May 2021, 10:12
by sfernandez
Great, marking this as solved.