为什么Button的边框粗细没有改变?
如果我将边框厚度更改为 1 或 100,则没有关系。一样的。我想用它来改变它Style, not 自定义模板.
<Window x:Class="GUI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style x:Key="newYellowButton" TargetType="{x:Type Button}">
<Setter Property="Width" Value="100"/>
<Setter Property="Height" Value="100"/>
<Setter Property="Background">
<Setter.Value>
<RadialGradientBrush Center="0.5,0.5" GradientOrigin="0.5,0.5" RadiusX="0.5" RadiusY="0.5" SpreadMethod="Pad" ColorInterpolationMode="SRgbLinearInterpolation">
<GradientStop Color="#FFEEEE3B" Offset="0.5" />
<GradientStop Color="#FFF0E49A" Offset="1" />
</RadialGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderThickness" Value="9"/>
<Setter Property="BorderBrush" Value="Blue" />
<Setter Property="Padding" Value="-4"/>
</Style>
</Window.Resources>
<Grid>
<Button Style="{StaticResource newYellowButton}" Content="Ok"/>
</Grid>
您可以通过更改来做到这一点按钮的控件模板。将样式、画笔等复制到您的资源字典中,然后更改您想要的值。
要更改边框粗细,请找到以下代码并进行所需的更改:
...
<Border
x:Name="Border"
CornerRadius="2"
BorderThickness="1" //CHANGE THIS VALUE
Background="{StaticResource NormalBrush}"
BorderBrush="{StaticResource NormalBorderBrush}">
<ContentPresenter
Margin="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
RecognizesAccessKey="True"/>
</Border>
...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)