0
votes

I need to set Height,Width and Border Color for Each list items in the Listbox. In the event that I set Setter Property it's setting for entire listbox. Be that as it may, I need to set every last rundown thing. Any one help me.

here's my code:

  <ListBox x:Name="lbOne" PreviewMouseLeftButtonDown="ListBox_PreviewMouseLeftButtonDown"
             HorizontalAlignment="Left" Margin="12,29,0,12" Width="215"  
             ScrollViewer.VerticalScrollBarVisibility="Visible" /> 
1

1 Answers

0
votes

Try the following piece of code and let me know if it works for you.

<ListBox ...>
<ListBox.ItemContainerStyle>
    <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    </Style>
</ListBox.ItemContainerStyle>

Also, please refer the followings link for reference.

Probably, refer to the below link for using the ListBox Item properties appropriately.