I want to customize the following Listbox-display property of border with CornerRadius=5..can anyone help me to achieve it without changing the existing datatemplate code in the following Xaml code:
<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>
Best Answer
If you want the
Border
within theListBoxItems
to have anotherCornerRadius
value, you can either re-templateListBoxItem
where theBorder
is defined, or set it implicitly in theItemContainerStyle
ResourcesEdit: If you want to set
CornerRadius
for theListBox
, you can do the same but inResources
instead