I have a GroupBox in a Listbox and the GroupBox's width automaticly fit it's content. I want to fit the ListBox's width (even if resized) and never have any Scrollbar.
Here is my XAML :
<ListBox Name="ListBox_1">
<ListBox.ItemTemplate>
<DataTemplate>
<GroupBox Header="{Binding Name}" Margin="5">
<!--DATA-->
</GroupBox>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
I have tried to set set the HorizontalAlignment's property of the GroupBox, but there is no effect. Thanks in advance.
you can use Grid or stackPanel within GroupBox for display data.and set Grid Height and Width dynamically auto
or *
.and set ListBox ItemTemplate Propery HorizontalContentAlignment="Stretch"