Wpf: Loading DataGrid in Groupbox causes Groupbox to be too tall
Posted
by Rick Make
on Stack Overflow
See other posts from Stack Overflow
or by Rick Make
Published on 2010-04-23T20:56:54Z
Indexed on
2010/04/23
21:13 UTC
Read the original article
Hit count: 433
I have a GroupBox that contains a stackpanel holding a textbox and a datagrid. When I use the textbox to populate the datagrid. Sometimes I need to load the datagrid with values. What I am noticing is that when the groupbox renders when the datagrid has values that the height of the groupbox is maxed out to the size of its parent container. And when I add a value via the textbox the groupbox snaps back to its proper height. Is there something that I am missing? When the datagrid renders it looks like all the text in the textcolumns render vertically and then snap into place.
<StackPanel x:Name="LeftDock" Margin="0" VerticalAlignment="Top" MinHeight="480" Width="650" >
<GroupBox x:Name="g_grpBx" Margin="8,8,0,0" Padding="0,10,0,0" MaxWidth="635" MinWidth="612" VerticalAlignment="Top">
<StackPanel x:Name="g_dp" VerticalAlignment="Top">
<local:TextboxControl x:Name="m_txbx" Margin="0" VerticalAlignment="Top" MinWidth="592"/>
<local:GoalDataGrid x:Name="goalDataGrid" Height="Auto" MinHeight="25" MinWidth="592" Margin="0" Padding="0" VerticalAlignment="Top"/>
</StackPanel>
</GroupBox>
</StackPanel>
© Stack Overflow or respective owner