I'm struggling with my XAML! I have 3 rows, and they don't really change height on the page, other than the middle row. The middle row has a ListBox.
Depending on the size of the screen I would like the 2nd row's height to get bigger as items are added to the ListBox unless it pushes the 3rd row out of the screen. In this case, I'd like the ListBox to show a Scrollbar. I'm not sure how I can achieve this.
My research shows for Height we have Auto and * - the Auto will size based upon the control, and the * will fill the entire gap. I can't see how either of these fit what I need really...
The following is code from a UserControl. This UserControl is rendered in the parents TabControl.
My effort is
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<TextBlock Text="[?] Source directory" />
</StackPanel>
<ListView ScrollViewer.VerticalScrollBarVisibility="Auto" ItemsSource="{Binding Folders}" Grid.Row="1" >
<ListBox.ItemTemplate>
<DataTemplate>
//data template code
</DataTemplate>
</ListBox.ItemTemplate>
</ListView>
<StackPanel Grid.Row="2">
<Button Content="Save" />
</StackPanel>
</Grid>
Edit
If I set a height on the grid, it works, but, setting a fixed height is not an option as it won't scale for any resolution.