WPF带小箭头的按钮_.NET_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > .NET > WPF带小箭头的按钮

WPF带小箭头的按钮

 2017/12/6 11:26:17  秋荷雨翔  程序员俱乐部  我要评论(0)
  • 摘要:XAML代码:<ControlTemplatex:Key="btnTpl"TargetType="RadioButton"><StackPanelOrientation="Vertical"Height="30"Background="Transparent"><BorderName="border"Background="#006AB8"Height="25"><
  • 标签:

XAML代码:

class="code_img_closed" src="/Upload/Images/2017120611/0015B68B3C38AA5B.gif" alt="" />logs_code_hide('5010fd0f-37aa-4874-9817-4a156affe6db',event)" src="/Upload/Images/2017120611/2B1B950FA3DF188F.gif" alt="" />
<ControlTemplate x:Key="btnTpl" TargetType="RadioButton">
    <StackPanel Orientation="Vertical" Height="30" Background="Transparent">
        <Border Name="border" Background="#006AB8" Height="25">
            <ContentPresenter Name="contentPre" VerticalAlignment="Center" HorizontalAlignment="Center" TextElement.Foreground="#FFF" TextElement.FontSize="12" Margin="0"/>
        </Border>
        <Path x:Name="path" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 6 4 L 12 0 Z">
            <Path.Fill>
                <SolidColorBrush Color="#006AB8" />
            </Path.Fill>
        </Path>
    </StackPanel>
    <ControlTemplate.Triggers>
        <Trigger Property="IsMouseOver" Value="True">
            <Setter TargetName="border" Property="Margin" Value="2 2 2 0"></Setter>
            <Setter TargetName="border" Property="Height" Value="23"></Setter>
            <Setter Property="TextElement.FontSize" Value="11"></Setter>
        </Trigger>
        <Trigger Property="IsChecked" Value="true">
            <Setter TargetName="border" Property="Border.Background" Value="#15BDF7"></Setter>
            <Setter TargetName="path" Property="Fill" >
                <Setter.Value>
                    <SolidColorBrush Color="#15BDF7" />
                </Setter.Value>
            </Setter>
        </Trigger>
    </ControlTemplate.Triggers>
</ControlTemplate>
View Code

效果图:

 

  • 相关文章
发表评论
用户名: 匿名