Silverlight Set Custom Tool Tip Programmatically
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
Answers & Comments...
No comments:
Post a Comment
Send us your comment related to the topic mentioned on the blog