Question

I have two datagrids side by side in on the same row, different columns. My left side datagrid has a width between 400-500 depending on the data. The right hand side grid is usually only 50 to a max of 100. My issue is the right hand data grid is stretching to match the left hand side grid height. Is there anyway to disable this?

<sdk:DataGrid Margin="0,0,10,10" 
              MaxWidth="420"   
              Grid.ColumnSpan="2" 
              Grid.Column="0" 
              Grid.Row="0" 
              AutoGenerateColumns="false"  
              IsReadOnly="True" 
              x:Name="pricinggrid" >
</sdk:DataGrid>

 <sdk:DataGrid AutoGenerateColumns="False" 
               Grid.ColumnSpan="2" 
               Grid.Row="0" 
               Grid.Column="2" 
               MaxWidth="380"  
               IsReadOnly="True" 
               x:Name="adjgrids">
Was it helpful?

Solution

Let's see: you placed them both in Grid.Row="0", I assume the default VerticalAlignment of the DataGrid to be Stretch. That means they will both fill the vertical space offered by the row. Try to set...

<sdk:DataGrid Grid.Column="2" VerticalAlignment="Top" ... />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top