Need to move tab focus to the popup element

Magesh Sankar 36 Reputation points

I have custom control, in which i need to provide keyboard navigation support for all elemenst used in it, but I have failed to move tab focus to popup element on button click. Please find the code for reproducing.I have used move focus method to navigate focus

<Popup x:Name="popup" Placement="Bottom" Focusable="True" PlacementTarget="{Binding ElementName=button}">
<DockPanel Focusable="True">
<ToggleButton Focusable="True" >button1</ToggleButton>
<ToggleButton Focusable="True">button1</ToggleButton>
<ToggleButton Focusable="True">button1</ToggleButton>


Please suggest solution to move focus to popup element on button click.


Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,709 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alex Li-MSFT 1,096 Reputation points

    Welcome to our Microsoft Q&A platform!

    In WPF, the element that has keyboard focus will have IsKeyboardFocused set to true. The default value of Popup.IsKeyboardFocused is false and read only property, so you can't get focus on the popup. You could use Keyboard.Focus(targetedElement) in the event to make it to be focused. You can refer to document Keyboard Focus and sample in the thread: WPF Popup tab key bug for more info.
    Keyboard Focus


    0 comments No comments