在WPF中创建圆形按钮

时间:2015-06-26 06:08:04

标签: wpf vb.net

我想让我的按钮圆边。我的按钮代码如下: -

<Button Grid.Column="1" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" HorizontalAlignment="Center"  BorderThickness="1" Foreground="White" FontFamily="Arial,Helvetica,sans-serif" Width="85"  Background="#6F933D" BorderBrush="#48671E" CommandParameter="11" Command="{Binding AuditCommand}" Visibility="{Binding ViewModel.IsCompleteAccessible}" Margin="38,0,60,0" Height="24" VerticalAlignment="Bottom">Complete</Button>

请帮助。

由于

1 个答案:

答案 0 :(得分:2)

试试这个

<Window.Resources>
        <Style x:Key="test" TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Name="ButtonBorder" CornerRadius="10" BorderThickness="1" BorderBrush="Gray" Background="LightGray">
                            <ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <Button Content="Button" Style="{StaticResource test}" Margin="0,137,0,0"  />
<Grid>