i'm trying to make a balloon tooltip with close button in a silverlight web 开发者_运维百科application.... how can i do it?
There's an MSDN blog entry on how to customize the tooltip. Basically you:
set the ToolTip's Template property to a fancy new Template which is defined in the page resources.
The code is this:
<UserControl.Resources>
<ControlTemplate x:Key="ToolTipTemplate">
<Border>
<Grid>
-- other stuff --
<ContentPresenter Grid.Column="1"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center"/>
</Grid>
</Border>
</ControlTemplate>
</UserControl.Resources>
and then to use it:
<TextBox Height="20" Width="100">
<ToolTipService.ToolTip>
<ToolTip Template="{StaticResource ToolTipTemplate}">
<ToolTip.Content>
<TextBlock
Text="This is a longer string of text."
FontFamily="Georgia" FontSize="14" TextWrapping="Wrap"/>
</ToolTip.Content>
</ToolTip>
</ToolTipService.ToolTip>
</TextBox>
(code copied from the blog entry).
I wrote an article recently, that shows a balloon tool tip, which can be placed over any FrameworkElement in Silverlight. Also the alignment can be changed using the Alignment property in Balloon.
Notification Control in Silverlight
精彩评论