小编som*_*har的帖子

使用CornerRadius为ListBox自定义Border属性

我想使用CornerRadius = 5来自定义边框的以下Listbox-display属性.任何人都可以帮助我实现它而无需更改以下Xaml代码中的现有datatemplate代码:

<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>
Run Code Online (Sandbox Code Playgroud)

wpf xaml listbox border cornerradius

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

border ×1

cornerradius ×1

listbox ×1

wpf ×1

xaml ×1