日期:2014-05-17  浏览次数:21115 次

wpf,如何设计win8风格的按钮
我说的是普通按钮,略带扁平化即可,如何设计??
如图:
wpf 扁平化 button

------解决方案--------------------
重写button的style然后里面


<Style TargetType="{x:Type Button}">
                    <Setter Property="Template" >
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type Button}">
                                <Border BorderBrush="Gray" BorderThickness="1" Margin="5" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                    <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" />
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

------解决方案--------------------
参考下这个吧

<Style TargetType="Button">
            <Setter Property="Foreground" Value="Black"/>
            <!--修改模板属性-->
            <Setter Property="Template">
                <Setter.Value>
                    <!--控件模板-->
                    <ControlTemplate TargetType="Button">
                  &