I have a DataGrid with RowDetailsTemplate that contains a DataGrid. The parent grid is placed in it's own row. The row is defined as
<RowDefinition Height="*" />
Usually this means the row will take the REST of the available hight and initialy it does. But if the DataGrid is too large for the space left on the screen, the buttom of the DataGird disaperas "under the screen" instead of getting a scrollbar.
I have tried to solve it by defining MaxHeight=400 for parent grid but even than, the parent grid is unlimited in it's length and still gets so long that it's buttom part is invisible.
Any ideas what to do about it?
Setting MaxHight to the parent grid has no effect what so ever on the grid's height. On the other hand, Setting a MaxHight to the inner grid does work.
Therefore I solved like this: First I took my row and named it "rowGridRow".
Than I subscribed on the Loaded event of the inner grid and did this:
private void dgGroupMedlem_Loaded(object sender, RoutedEventArgs e)
{
DataGrid dgGroupMedlem = sender as DataGrid;
dgGroupMedlem.MaxHeight = rowGridRow.ActualHeight - xxx;
}
xxx is some value that compensates for the other things around (like headers) and should likely be calculated based on the number of rows that the parent grid have.