0

I have created the following custom tooltip with the custom template.

<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>    

What i need to do is, from within a behvior i need to set the tooltip of the assosciated object to an instance of my custom tool tip control.

Something like

toolTip = new CustomToolTip() {Content = new TextBlock() {Text = text, FontSize = 12}};

However this isn't working.

Could someone possibly point me in the right direction?

Thanks

Steve

4

1 に答える 1

0

別のサードパーティのツールチッププロバイダーを使用しました。.netフレームワークに組み込まれているものだけでは十分ではありません。

于 2012-10-09T09:58:35.237 に答える