本人想设置Button为圆角,奈何搜索百度,找到的全是坑爹答案,现总结如下:
1. 需要添加button 的template.
2. 设置border的时候,必须要设置background, 否则会提示content 被多次使用。
<Button Grid.Row="3" Grid.Column="2" Content="取消" Margin="30,40,200,40" > <Button.Template > <ControlTemplate TargetType="{x:Type Button}" > <Border BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="1" CornerRadius="7,7,7,7"> <Border.Background>#FFDDDDDD</Border.Background> <ContentPresenter Content="{TemplateBinding ContentControl.Content}" HorizontalAlignment="Center" VerticalAlignment="Center" ></ContentPresenter> </Border> </ControlTemplate> </Button.Template> </Button>