I am facing a problem with setting the following xaml layout:
RowHeightAuto.xaml
This is exactly as you say it is.
The reason why you do not see the Scrollbar
's is because even though the Grid
Clip's the DataGrid
, it's merely a Clip, the ActualHeight
of the DataGrid
is the height it would get if allowed to show all it's children. You are thus not seeing it's scrollbar's. ActualHeight
is so cos it's allowed to get all the space it wants with Height="Auto"
on the Grid
. The reason I wouldn't call this a bug personally is cos you might desire this behavior if you want to play with the Thinking about this, I actually think I'd call this a bug too in terms of "Not desirable functionality" than "Incorrect output"ClipToBounds
property of the Grid
for certain animations and this is the behavior you desire.
To get the behavior your looking for,
MaxHeight
on the DataGrid
or use Grid RowDefinition.Height="*"
<- both as you mentioned (Not sure why you say this is not what you want to do?)RelativeSourceBinding
on the DataGrid
something like -
<DataGrid Name="DataGrid1"
Grid.Row="1"
Height="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type Grid}},
Path=RowDefinitions[1].ActualHeight}">
For such issues Snoop is your friend. You can easily check this behavior and realize why the scrollbar's aren't shown when you check the ActualHeight
on your DataGrid
using Snoop and see it allocates quite a bit more height to the child control.