【桌面开发】WPF中button去边框
程序员文章站
2022-06-10 10:58:53
...
1、BorderThickness=“0”:加上这个就可以去掉边框线了
2、鼠标经过的时候还是会显示一个大按钮,重写Button的ControlTemplate解决
<ControlTemplate x:Key="ReturnButton" TargetType="{x:Type Button}">
<Grid>
<Rectangle>
<Rectangle.Fill>
<ImageBrush ImageSource="/Images/btngreynomal.png" ></ImageBrush>
</Rectangle.Fill>
</Rectangle>
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
</Grid>
</ControlTemplate>