2013-02-13 78 views
0
<DataGrid Grid.Row="3" AutoGenerateColumns="False" Height="auto" x:Name="grdData" TabIndex="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="Transparent" VerticalContentAlignment="Center" HorizontalContentAlignment="Stretch" PreviewKeyDown="grdData_KeyDown" MouseDoubleClick="grdData_MouseDoubleClick" Margin="5"> 
      <DataGrid.Columns> 
       <DataGridTextColumn Width="100" Header="Code" IsReadOnly="True" /> 
       <DataGridTextColumn Width="*" Header="Name" IsReadOnly="True"> 
       <DataGridTextColumn.ElementStyle> 
        <Style TargetType="TextBlock"> 
          <Setter Property="TextWrapping" Value="Wrap"/> 
        </Style> 
        </DataGridTextColumn.ElementStyle> 
       </DataGridTextColumn> 
      </DataGrid.Columns> 

我在WPF中DataGrid的TextWrapping存在問題,它只顯示2行。TextFrapping DataGrid在WPF中只顯示2行

如果我增加網格rowheight我可以看到我的文本。 請幫忙嗎?

+0

提供更多信息和[你有什麼嘗試?](http://whathaveyoutried.com) – arulmr 2013-02-13 12:34:07

回答

0

感謝上帝我解決了它 在窗口的構造函數 set dataGrid.RowHeight = double.NaN;