如何删除所有控件的全局 FocusVisualStyle? [英] How to remove global FocusVisualStyle to all the Controls?

查看:34
本文介绍了如何删除所有控件的全局 FocusVisualStyle?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了与全局停用 FocusVisualStyle 相同的问题.

I met the same problem as Deactivate FocusVisualStyle globally.

但没有一个答案行得通.

But none of the answers can work.

所以,我只想在我的应用程序 FocusVisualStyle="{x:Null}" 中设置所有控件,任何实现这一目标的有效方法?

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.

推荐答案

把它放到你的 Application.Resources 中怎么样?:

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>

由于 Control 是从 FrameworkElement 派生出来的,所以它们也会使用这个 Style.

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

这篇关于如何删除所有控件的全局 FocusVisualStyle?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆