title: WPF DataGrid row height
body: <p>I have a datagrid in a WPF project. I've set the columns width to be have maximum limits,<br>
  and I want the data to likewise be stretched to fit in the rows. But that doesn't happen.... The contents just stays the same size and the cell is cutoff. Any ideas?  </p>
  
  <p>Here is the code :</p>
  
  <pre><code>&lt;DockPanel&gt;
  &lt;DataGrid x:Name="nirGrid" x:Uid="nirGrid" AutoGenerateColumns="False"      AlternationCount="2" SelectionMode="Single" DockPanel.Dock="Top" Margin="10,50,10,50" FlowDirection="RightToLeft" ColumnWidth="SizeToCells" CanUserSortColumns="False" CanUserResizeColumns="False" CanUserReorderColumns="False" GridLinesVisibility="None" HeadersVisibility="None" SelectionUnit="Cell" VerticalAlignment="Stretch" EnableRowVirtualization="False" IsReadOnly="True" RowDetailsVisibilityMode="Visible" MinRowHeight="0" CanUserResizeRows="True" RowHeaderWidth="0"&gt;
          &lt;DataGrid.Style&gt;
              &lt;Style&gt;
                  &lt;Setter Property="ScrollViewer.CanContentScroll" Value="False" /&gt;
              &lt;/Style&gt;
          &lt;/DataGrid.Style&gt;
          &lt;DataGrid.Columns &gt;
              &lt;DataGridTextColumn Binding="{Binding Path=task_desc}" IsReadOnly="True" Header="test1" Width="SizeToCells" MaxWidth="330" &gt;
  
              &lt;/DataGridTextColumn&gt;
              &lt;DataGridTextColumn Binding="{Binding Path=task_req_date}" IsReadOnly="True" Header="test2" Width="SizeToCells" MaxWidth="70" &gt;
  
              &lt;/DataGridTextColumn&gt;
  
              &lt;DataGridTemplateColumn Header="delete" &gt;
                  &lt;DataGridTemplateColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;Button Content="delete" ToolTip="delete" Opacity="0.8" Click="Button_Click" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave"&gt;
                              &lt;Button.Template&gt;
                                  &lt;ControlTemplate&gt;
                                      &lt;Border HorizontalAlignment="Center" VerticalAlignment="Center"&gt;
                                          &lt;Image Source="/exhibits;component/Images/exit1.png" Width="15" Height="15" /&gt;
                                      &lt;/Border&gt;
                                  &lt;/ControlTemplate&gt;
                              &lt;/Button.Template&gt;
                          &lt;/Button&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/DataGridTemplateColumn.CellTemplate&gt;
              &lt;/DataGridTemplateColumn&gt;
  
  
          &lt;/DataGrid.Columns&gt;
  
      &lt;/DataGrid&gt;
  </code></pre>