【发布时间】:2016-03-27 22:37:09
【问题描述】:
我正在尝试让我的 UserControl 显示圆角。
这是我的标记:
<Border CornerRadius="10" Padding="5" HorizontalAlignment="Center" VerticalAlignment="Center" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="20" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10" />
<ColumnDefinition Width="220" />
<ColumnDefinition Width="10" />
</Grid.ColumnDefinitions>
<Grid.Background>
<ImageBrush ImageSource="{StaticResource NavyBlueGround}" />
</Grid.Background>
<Label Grid.Column="1" Grid.Row="0" Style="{StaticResource GelTitle}" Content="Customer Search" VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
<Label Grid.Row="1" Grid.Column="1" Style="{StaticResource GelCaption}" Content="Enter Customer First Name" VerticalAlignment="Bottom" />
<TextBox Grid.Row="2" Grid.Column="1" Name="txtForeName" Background="White" VerticalContentAlignment="Center"/>
<Label Grid.Row="3" Grid.Column="1" Style="{StaticResource GelCaption}" Content="Enter Customer Last Name" VerticalAlignment="Bottom" />
<TextBox Name="txtSurname" Grid.Column="1" Grid.Row="4" FontSize="14" Text="hello" VerticalContentAlignment="Center" VerticalAlignment="Stretch" HorizontalContentAlignment="Center" />
<Button Name="btnCustomerSearch" Grid.Column="1" Grid.Row="5" Style="{StaticResource GelButton}" Content="Search" Click="btnCustomerSearch_Click" VerticalAlignment="Center" />
</Grid>
</Border>
这就是它的样子:
【问题讨论】:
-
为边框添加不透明背景,您将开始看到圆角。
标签: wpf user-controls rounded-corners