Is there any way how to tell component in WPF to take 100% of available space?
Like
width: 100%;
in CSS
It is the container of the Grid
that is imposing on its width. In this case, that's a ListBoxItem
, which is left-aligned by default. You can set it to stretch as follows:
<ListBox>
<!-- other XAML omitted, you just need to add the following bit -->
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
You could use HorizontalContentAlignment="Stretch"
as follows:
<ListBox HorizontalContentAlignment="Stretch"/>