BartekW
Topic Author
Posts: 53
Joined: 24 Mar 2021, 14:33

WPF Keyboard Navigation - Set element as focused

30 Apr 2021, 14:03

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?
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: WPF Keyboard Navigation - Set element as focused

30 Apr 2021, 19:26

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>
 
BartekW
Topic Author
Posts: 53
Joined: 24 Mar 2021, 14:33

Re: WPF Keyboard Navigation - Set element as focused

04 May 2021, 09:42

Yes, thanks that worked :)
 
User avatar
sfernandez
Site Admin
Posts: 2984
Joined: 22 Dec 2011, 19:20

Re: WPF Keyboard Navigation - Set element as focused

05 May 2021, 10:12

Great, marking this as solved.

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 61 guests