control作为tooltip后,外框背景是白色的,并且有边框。 我们可以定义 一个样式去掉。
<Style x:Key="ToolTipTransparentStyle" TargetType="ToolTip">
<Setter Property="Background" Value="#FFF7F8FA"/>
<Setter Property="Padding" Value="0,0,0,0"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFA3AEB9" Offset="0"/>
<GradientStop Color="#FF8399A9" Offset="0.375"/>
<GradientStop Color="#FF718597" Offset="0.375"/>
<GradientStop Color="#FF617584" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToolTip">
<Border x:Name="Root" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
<Border BorderThickness="1" CornerRadius="1" Padding="{TemplateBinding Padding}">
<Border.Resources>
<Storyboard x:Key="Visible State"/>
<Storyboard x:Key="Normal State"/>
</Border.Resources>
<ContentPresenter Cursor="{TemplateBinding Cursor}" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/>
</Border>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
在创建 ToolTip实例的时候,把ToolTip.Style 用上这个样式就可以了。
参考:http://www.cnblogs.com/eagle1986/archive/2012/05/12/2497189.html