title: WPF Datagrid - Force singleline rows
body: <p>I'm working on a datagrid in WPF and I have encountered a problem.</p>
  
  <p>When adding a multiline string to my DataGridTextColumn, the row is expanded in height so as to fit the entire text. I wish the row height to remain constant at all times, ie only show the first line.</p>
  
  <p>Does anyone know a solution? Seems like a simple enough task, but I havn't been able to find anything of worth on the subject.</p>
  
  <p>Here is my XAML:</p>
  
  <pre><code>&lt;DataGrid Grid.Row="0" AutoGenerateColumns="False" HorizontalAlignment="Stretch" Name="dgPosts" VerticalAlignment="Stretch"
                              SelectionMode="Single" SelectionUnit="FullRow" ItemsSource="{DynamicResource LogPosts}" CanUserAddRows="False"
                              IsReadOnly="True" GridLinesVisibility="Vertical" RowHeaderWidth="0" Margin="0,0,0,0"
                              CanUserReorderColumns="True" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="True" SelectionChanged="dgPosts_SelectionChanged"&gt;
     &lt;DataGrid.Columns&gt;
           &lt;DataGridTextColumn Header="Tidpunkt" Width="120" Binding="{Binding Path=TimeStr}"/&gt;
           &lt;DataGridTextColumn Header="Posttyp" Width="55" Binding="{Binding Path=PostTypeStr}" CellStyle="{StaticResource CenterCellStyle}"/&gt;
           &lt;DataGridTextColumn Header="Beskrivning" Width="*" Binding="{Binding Path=Text}"/&gt;
     &lt;/DataGrid.Columns&gt;
     &lt;DataGrid.RowStyle&gt;
           &lt;Style TargetType="DataGridRow"&gt;
              &lt;Setter Property="Background" Value="{Binding Path=Color}"/&gt;
              &lt;Style.Triggers&gt;
                 &lt;Trigger Property="DataGridRow.IsSelected" Value="True" &gt;
                       &lt;Setter Property="Background" Value="Black" /&gt;
                 &lt;/Trigger&gt;
              &lt;/Style.Triggers&gt;
           &lt;/Style&gt;
     &lt;/DataGrid.RowStyle&gt;
     &lt;DataGrid.CellStyle&gt;
           &lt;Style TargetType="DataGridCell"&gt;
              &lt;Setter Property="BorderThickness" Value="0"/&gt;
           &lt;/Style&gt;
     &lt;/DataGrid.CellStyle&gt;
     &lt;DataGrid.Resources&gt;
           &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/&gt;
     &lt;/DataGrid.Resources&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>Thanks in advance!</p>