我使用自定义模板创建了以下自定义工具提示。
<ToolTip x:Class="FireFly.Controls.CustomToolTip"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<ToolTip.Style>
<Style TargetType="ToolTip">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToolTip">
<Border>
<Border.Background>
<RadialGradientBrush>
<GradientStop Color="WhiteSmoke"/>
<GradientStop Color="#FFE0E0E0" Offset="1"/>
</RadialGradientBrush>
</Border.Background>
<ContentPresenter Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ToolTip.Style>
我需要做的是,在一个行为中,我需要将assosciated对象的工具提示设置为我的自定义工具提示控件的实例。
像
这样的东西toolTip = new CustomToolTip() {Content = new TextBlock() {Text = text, FontSize = 12}};
然而这不起作用。
有人可能指出我正确的方向吗?
由于
史蒂夫
答案 0 :(得分:0)
我使用了另一个第三方工具提示提供商。内置于.net框架中的内容不够好。