如何在样式中创建wpf中的圆角按钮?

时间:2015-07-15 08:22:14

标签: xaml styles wpf-controls rounded-corners app.xaml

最有可能它可能是重复但我的问题是不同的,我想在样式的wpf UserControl中创建一个圆角的关闭角按钮。我不知道如何实现这一点,enter image description here

我试着如下。

<Style x:Key="dbokPopupCloseStyle"  TargetType="Button">
            <Setter Property="Padding" Value="5"></Setter>
            <Setter Property="BorderThickness" Value="0"></Setter>
            <Setter Property="FontWeight" Value="Normal"/>
            <Setter Property="FontFamily" Value="seoge UI"/>
            <Setter Property="FontSize" Value="17"/>
            <Setter Property="Cursor" Value="Hand"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="Background" Value="#363636"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid  Background="{TemplateBinding Background}">
                            <ContentPresenter HorizontalAlignment="Center" Margin="10,5"
                    VerticalAlignment="Center"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

0 个答案:

没有答案