I have a custom Popup that overlays part of my screen. When it is open, I want to disable tabbing into the UserControl behind it. I do not want to use the IsEnabled
property because I do not want to gray out all the controls.
Is there another property that does the same thing? IsTabStop
only prevents the tab from stopping on the UserControl itself, not it's children, and IsFocusable
isn't a valid property for a UserControl.
You can bind
IsTabStop
on the child controls toIsTabStop
on theUserControl
.That way, you only have to set it once.
Just bind that property to the user control.
You could write an attached property that you would set in the top element.
That attached property would recursively set IsTabStop to false in all the child elements.
Let me know if you need any help getting this to work.
The solution with
KeyboardNavigation.TabNavigation="None"
seems to bubble up to all other parent containers in my case. This is maybe not wanted in some scenarios. So I came up with a PreviewKeyDown-Event in code behind like this:Use the KeyboardNavigation.TabNavigation Attached Property with KeyboardNavigationMode.None on your container control.