码迷,mamicode.com
首页 > 其他好文 > 详细

Siverlight去掉ToolTip的白色边框

时间:2015-03-04 21:03:26      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:

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

Siverlight去掉ToolTip的白色边框

标签:

原文地址:http://www.cnblogs.com/yy3b2007com/p/4314154.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!