Data Grid Auto Height Issue

Dec 3, 2009 at 3:28 AM

hi friends i use wpf Datagrid. I Add four DataGridTemplateColumn in each column i add Textblock when i Add Textwarp property to wrap and bind the data grid with source There is lot of white space.

My source have only one record but when i remove that Textwarp property it wrok fine or give some fix height or max Height it work good.

My datagrid code is here. I remove all the style that i apply but it didnot work.

  

<Custom:DataGrid VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling"EnableRowVirtualization="True" SelectionUnit="FullRow" RowBackground="Aqua" AlternatingRowBackground="Beige"IsReadOnly="True" SelectionMode="Extended" AutoGenerateColumns="False" Background="White" FontWeight="Bold"FontFamily="Arial" FontSize="10.667" Height="Auto" x:Name="dgChronicDiagnosis" HorizontalGridLinesBrush="{x:Null}"VerticalScrollBarVisibility="Auto" MinHeight="0" VerticalGridLinesBrush="{x:Null}" GridLinesVisibility="None"RowDetailsVisibilityMode="Collapsed" BorderBrush="{x:Null}" ColumnHeaderStyle="{DynamicResource DataGridColumnHeaderStyle}" RowStyle="{DynamicResource DataGridRowStyle1}" BorderThickness="0" Margin="0,4,0,0"VerticalAlignment="Center" VerticalContentAlignment="Stretch" IsSynchronizedWithCurrentItem="True"AreRowDetailsFrozen="True">
<Custom:DataGrid.Columns>


<Custom:DataGridTemplateColumn Header="OnSet" Width="10*" CellStyle="{DynamicResource TempDataGridCellStyle}" >
<Custom:DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<TextBlock Text="{Binding ONSET}" TextWraping = "wrap" FontFamily="Arial" FontSize="10.667"/>
</DataTemplate>
</Custom:DataGridTemplateColumn.CellTemplate>
</Custom:DataGridTemplateColumn>

</Custom:DataGrid.Columns>
</Custom:DataGrid>


Now when i bind the Data grid with list having one record there i lot of white space as record increases the space also increases