zoukankan      html  css  js  c++  java
  • WPF ToggleButton Style

    <Style x:Key="ArrowToggleStyle" TargetType="ToggleButton">
        <Setter Property="Background" Value="Gray"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToggleButton">
                    <Border Background="{TemplateBinding Background}">
                        <Grid>
                            <Image x:Name="leftArrowImg" Source="/Graphics/arrow_left24.png" Width="24" Height="24"  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <Image x:Name="rightArrowImg" Source="/Graphics/arrow_right24.png" Width="24" Height="24"  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <ContentPresenter x:Name="content1" Content="not selected" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <ContentPresenter x:Name="content2" Content="SELECTED" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter Property="Background" Value="DimGray"/>
                            <Setter TargetName="leftArrowImg" Property="Visibility" Value="Hidden"/>
                            <Setter TargetName="rightArrowImg" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="content1" Property="Visibility" Value="Hidden"/>
                            <Setter TargetName="content2" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsChecked" Value="False">
                            <Setter TargetName="leftArrowImg" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="rightArrowImg" Property="Visibility" Value="Hidden"/>
                            <Setter TargetName="content1" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="content2" Property="Visibility" Value="Hidden"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
  • 相关阅读:
    CRM PrincipalObjectAccess(POA)
    crmForm.SubmitCRMForm
    transactionCurrencyId needs to be supplied to format a transaction money field.
    GitLab 之 Linux十分钟快装
    GitLab 之 Linux十分钟快装
    秒杀系统架构分析与实战
    秒杀系统架构分析与实战
    秒杀系统架构分析与实战
    创建微服务?请先回答这10个问题
    创建微服务?请先回答这10个问题
  • 原文地址:https://www.cnblogs.com/bruce1992/p/14891551.html
Copyright © 2011-2022 走看看