I want to place a DataGrid inside a HeaderedContentControl, but the DataGrid does not get a vertical scroll bar. It seems to be sized to hold all the lines at once, and the bottom part disappears from view.
If I put the same DataGrid in the Border element, I will get the behavior that I want.
I brought it to this minimal example:
<Grid> <HeaderedContentControl Margin="10,10,10,161" > <HeaderedContentControl.Header >test</HeaderedContentControl.Header> <DataGrid ItemsSource="{Binding Path=AllData}" AutoGenerateColumns="True" /> </HeaderedContentControl> <Border Margin="10,169,10,10"> <DataGrid ItemsSource="{Binding Path=AllData}" AutoGenerateColumns="True" /> </Border> </Grid>
A few notes:
- I could not get it to work using HeaderedContentControl.VerticalContentAlignment
- this problem is related to this question , but I think I expanded it a bit and that there is a better answer.
- using a ScrollViewer around a DataGrid is not a solution because it scrolls the title out of sight.
- I am using WPF4
source share