码迷,mamicode.com
首页 > Windows程序 > 详细

wpf 类似TextBlock外观的Button的样式

时间:2015-09-20 11:49:20      阅读:274      评论:0      收藏:0      [点我收藏+]

标签:

  <Style x:Key="noborderbtnStyle" TargetType="{x:Type Button}">
            <Setter Property="Focusable" Value="false"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid x:Name="grid" Background="#00000000">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver"/>
                                    <VisualState x:Name="Pressed"/>
                                    <VisualState x:Name="Disabled"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <ContentPresenter Margin="0" Opacity="1" HorizontalAlignment="Center"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True"/>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True"/>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Background" TargetName="grid" Value="#FF0A861A"/>
                                <Setter Property="Opacity" TargetName="grid" Value="0.565"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <!--<Setter Property="MinWidth" Value="118"/>-->
        </Style>

 

wpf 类似TextBlock外观的Button的样式

标签:

原文地址:http://www.cnblogs.com/527289276qq/p/4822974.html

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