10

I met the same problem as Deactivate FocusVisualStyle globally.

But none of the answers can work.

So, I just want to set all the Controls in my application FocusVisualStyle="{x:Null}", any effecive way to achieve this?

I don't want to set each control separately.

Community
  • 1
  • 1
  • Possible duplicate of [Deactivate FocusVisualStyle globally](https://stackoverflow.com/questions/1055670/deactivate-focusvisualstyle-globally) – Tromse Jun 22 '17 at 08:32

1 Answers1

10

How about just putting this into your Application.Resources?:

<Style TargetType="{x:Type Control}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
</Style>

To also affect non-controls as well, try this instead:

<Style TargetType="{x:Type FrameworkElement}">
    <Setter Property="FocusVisualStyle" Value="{x:Null}" />
</Style>

As Control is derived from FrameworkElement, they will all use this Style also.

Sheridan
  • 68,826
  • 24
  • 143
  • 183
  • 4
    I did post such a question. But I left the comment above w/ good intentions, to alert others that this is not a universal solution. I am not the only one who leaves such comments. – Sabuncu Jul 31 '14 at 18:08
  • 1
    If I posted an answer that I thought was general but which turned out to be wrong in some unknown number of cases, I'd want to know about that. – 15ee8f99-57ff-4f92-890c-b56153 Nov 23 '15 at 20:18