【发布时间】:2023-04-10 04:21:01
【问题描述】:
我想用 CornerRadius=5 自定义边框的以下 Listbox-display 属性。任何人都可以帮我实现它,而无需更改以下 Xaml 代码中的现有数据模板代码:
<ListBox x:Uid="lst_value" Name="lstValues" Background="Wheat" BorderBrush="Black"
HorizontalAlignment="Left" VerticalAlignment="Top" BorderThickness="1" Height="100" Width="150"
ItemsSource="{Binding listval}" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Background="{Binding}">
<TextBlock x:Name="txtblk" Foreground="Black" FontSize="10" TextAlignment="Left"
FontWeight="Black" Text="{Binding}" Background="{Binding}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
【问题讨论】:
标签: wpf xaml listbox border cornerradius