私はWPFを使用して単純なボタンを作成しています.ボタンから各側から1ピクセルを引いたものと常に同じサイズにしたい単純なものを追加しています.
問題は、ボタンの width プロパティを使用する方法がわからないことです。
誰でも助けてくれますか?
ありがとう。
<UserControl
Name="UC_Button_Close"
x:Class="Colman_UC.UC_Button_Close"
xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x= "http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d= "http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc= "http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" RenderTransformOrigin="0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Grid MinWidth="70" MinHeight=" 30" Height=" 30" Width=" 70">
<Rectangle x:Name="MainRectangle" Stroke="Black" StrokeThickness="1" >
<Rectangle.BitmapEffect >
<DropShadowBitmapEffect Opacity="0.2" ShadowDepth="0" />
</Rectangle.BitmapEffect>
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFAECAD2" Offset="1" />
<GradientStop Color="#FFB9D5DD" Offset="0" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<!-- Here is the line concerned -->
<Line x:Name="RectangleLight" Stroke="white" X1="1" Y1="1" X2="69" Y2="1"/>
<TextBlock x:Name="MainText" HorizontalAlignment="Center"
VerticalAlignment="Center" Margin="0,0,0,0" Text="Button"
FontFamily="Avenir" />
</Grid>