Delete rectangle rectangle on UserControl

I have UserFontrol WPF with Focusable = "True". This is the only custom control in the window.

Whenever the user presses Tab or Alt (and especially when they Alt + Tab to another application), my UserControl gets the border with the dashed line, as well as the focus rectangle. Then the focus rectangle remains there until the window is closed.

How can I prevent my UserControl from showing this focus rectangle?

Edit

Turns out the focus rectangle wasn't actually displayed by my UserControl. My Focusable UserControl contained another UserControl, which in turn contained an ItemsControl, and ItemsControl is what the focus rectangle showed.

When I added FocusVisualStyle = "{x: Null}" to the ItemsControl, the focus rectangle is gone.

+41
wpf focus
May 04 '09 at 2:05 a.m.
source share
1 answer

If you do not want to display the focus rectangle, you can set FocusVisualStyle to null anyway.

<MyControl FocusVisualStyle="{x:Null}" /> 
+63
May 04 '09 at 11:11 a.m.
source share
— -



All Articles