I designed a view, which shows some information in it's upper part, and has a DataGrid below.
I want to ensure, that the upper part (in my sample the yellow rectangle) is always visible, and uses the maximum available space. That's why I defined a grid with two rows, the upper row uses Height="*" and MinHeight="200". The Datagrid below shall use all the space it needs to display it's rows not more, but shall leave the rectangle visible at least with it's min height.
If I resize the MainWindow to a smaller Y-Extent, the MinHeight of 200 will somewhen force the rectangle not to shrink anymore.
In that case, the datagrid should show its VerticalScrollBar. But instead, the datagrid seems to vanish below the window, so even the important horizontal scrollbar is not visible anymore.
Is there any chance to define the desired behavior in XAML?
Here is my xaml to show in details, what I mean:
<Window x:Class="MyNamespace.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Title="MainWindow" Height="450" Width="500"><Window.Resources><XmlDataProvider x:Key="Employees" XPath="/Employees/*"><x:XData><Employees xmlns=""><Employee Name="Terry Adams" Type="FTE" EmployeeNumber="1" /><Employee Name="Claire Donnell" Type="FTE" EmployeeNumber="12345" /><Employee Name="Palle Peterson" Type="FTE" EmployeeNumber="5678" /><Employee Name="Amy E. Alberts" Type="CSG" EmployeeNumber="99222" /><Employee Name="Stefan Hesse" Type="Vendor" EmployeeNumber="4711" /></Employees></x:XData></XmlDataProvider></Window.Resources><Grid><Grid.RowDefinitions><RowDefinition Height="*" MinHeight="200" /><RowDefinition Height="auto" /></Grid.RowDefinitions><Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Yellow" Margin="20" ><TextBlock Text="Important information will be shown here" HorizontalAlignment="Center" VerticalAlignment="Center"/></Border><DataGrid Grid.Row="1" AutoGenerateColumns="False" VerticalScrollBarVisibility="Auto" ItemsSource="{Binding Source={StaticResource Employees}}"><DataGrid.Columns><DataGridTextColumn Header="Name" MinWidth="250" Binding="{Binding XPath=@Name}"/><DataGridTextColumn Header="Type" MinWidth="250" Binding="{Binding XPath=@Type}"/><DataGridTextColumn Header="Employee number" MinWidth="250" Binding="{Binding XPath=@EmployeeNumber}"/></DataGrid.Columns></DataGrid></Grid></Window>