WPF-将工具提示背景更改为透明

Kyl*_*yle 2 wpf tooltip

我试图让它成为当我将鼠标悬停在我的应用程序中的按钮上时,"工具提示"显示我的措辞,以及透明背景,而不是白色背景.

我只是想将工具提示默认设置更改为透明背景..

我看了看,但没有成功..谁有任何想法?

谢谢.

Dom*_*ton 15

<Style x:Key="{x:Type ToolTip}"
       TargetType="{x:Type ToolTip}">
    <Setter Property="Background"
            Value="Transparent" />
</Style>
Run Code Online (Sandbox Code Playgroud)

将其放在视图的资源字典中,或者放在应用程序中.


Ale*_*icu 5

这是将工具提示背景设置为透明的最终样式:

<Style TargetType="{x:Type ToolTip}">
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="BorderBrush" Value="Transparent"/>
</Style>
Run Code Online (Sandbox Code Playgroud)

请注意,您还需要将BorderBrush设置为Transparent,而不仅仅是Background.