Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent tabbing to a UserControl?

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.

like image 437
Rachel Avatar asked Oct 12 '11 19:10

Rachel


2 Answers

Use the KeyboardNavigation.TabNavigation Attached Property with KeyboardNavigationMode.None on your container control.

KeyboardNavigation.TabNavigation="None"
like image 141
LPL Avatar answered Sep 17 '22 20:09

LPL


You can bind IsTabStop on the child controls to IsTabStop on the UserControl.

That way, you only have to set it once.

like image 28
Diego Mijelshon Avatar answered Sep 20 '22 20:09

Diego Mijelshon