问题
I am attempting to make it so that when I hover over a button in my application, the "tooltip" displays my wording, along with a transparent background, instead of the white background.
I am merely trying to change the tooltip default settings to a transparent background..
I have looked and looked, but to no success.. anyone have any ideas?
Thanks.
回答1:
<Style x:Key="{x:Type ToolTip}"
TargetType="{x:Type ToolTip}">
<Setter Property="Background"
Value="Transparent" />
</Style>
Place this in the resource dictionary of your view, or for your application.
回答2:
And this is the final style which sets the tooltip background to transparent:
<Style TargetType="{x:Type ToolTip}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
</Style>
Note that you need to set also the BorderBrush to Transparent, not only the Background.
回答3:
The class ToolTip has property Background. See http://msdn.microsoft.com/en-us//library/system.windows.controls.tooltip_members.aspx. You can set Background to Transparent.
来源:https://stackoverflow.com/questions/2314856/wpf-changing-tooltip-background-to-transparent