I have a xaml, which, more or less, looks as follows (I've filtered on Grid and RowDefinition related entries for showing Grid, DataGrid and RowDefinition entries:
<Grid x:Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="auto" MaxHeight="60"/>
<RowDefinition />
</Grid.RowDefinitions>
<Grid x:Name="Grd_Header" Grid.Row ="0" MaxHeight="60">
<Grid.RowDefinitions>
<RowDefinition Height="0"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="10"></RowDefinition>
</Grid.RowDefinitions>
</Grid>
<Grid x:Name="Grd_Data" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="10"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid x:Name="Grd_Act" Grid.Row="0" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<DataGrid Name="..." Grid.Row="1" Grid.Column="0">
<telerik:RadBusyIndicator Grid.Row="0" Grid.RowSpan="2" .../>
</Grid>
<GridSplitter Grid.Row="1" Height="3" Background="black" HorizontalAlignment="Stretch" />
<Grid x:Name="Grd_plan" Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*" MinHeight="50"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="planned..." Grid.Row="0" Grid.Column="0"/>
<DataGrid Grid.Row="1" ...>
<telerik:RadBusyIndicator Grid.RowSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BusyContent="Loading pallets" IsBusy="{Binding IsLoadingGepandeMatrijsPalletten}" Grid.ColumnSpan="2"/>
</Grid>
</Grid>
</Grid>
At first, the result looks more or less ok:
But from the moment I move the GridSplitter a bit, it goes partially wrong: there is a scrollbar (in green), which must stay present. But the grey space (in the red rectangle): where is that coming from?
(While debugging, I've understood that the grey area belongs to the general view or to the Grid, called MainGrid.)
Before I forget: the Grid.Resources contain different Style tags, like this one for DataGrid:
<Style TargetType="DataGrid">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="AutoGenerateColumns" Value="False"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="ColumnWidth" Value="Auto"/>
<Setter Property="FontSize" Value="12"/>
</Style>


I assume that both
Gridelements "Grd_Act" and "Grd_plan" are disturbing the layout.Their layout is not correct, and elements are not cleanly arranged (redundant properties, wrong values etc.).
Fixing these layout issues should bring back the expected resize behavior (triggered by the
GridSplitter)."Grd_Act"
This
Gridhas a very odd layout where there are three rows defined for two elements (why not two rows?).The arrangement of the elements is wrong too:
RadBusyIndicatoris placed in the first row and spanning two rows.DataGridis placed in the second row, which is also occupied by the spanningRadBusyIndicator- they overlap.Just make it two rows, one for each element:
"Grd_plan"
This
Gridhas correctly defined three rows, one for each element.However, the elements are not arranged correctly:
RadBusyIndicatoris placed in the first row - together with theTextBlock(overlap).RadBusyIndicatorhas aGrid.RowSpanproperty set to2, which doesn't make any sense (a typo?). Instead, the element must be placed in the third row.TextBlockis explicitly placed in column0and theRadBusyIndicatorspans across two columns. You should remove those redundantGrid.ColumnandGrid.ColumnSpanvalues.Don't use
GridRowSpanunless your elements are arranged in columns or you want to create overlays (using z-index).If you want to make the busy indicator to overlay the
DataGrid, simply put them in the same row and set thePanel.ZIndexproperty to control their rendering order (z-index). There is no row span required (or reasonable).