user1031200
user1031200

Reputation:

How to remove global FocusVisualStyle to all the Controls?

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.

Upvotes: 10

Views: 6270

Answers (1)

Sheridan
Sheridan

Reputation: 69979

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.

Upvotes: 9

Related Questions