---
title: "WPF DataGrid row height"  
description: "WPF DataGrid row height"  
author: "E E Cummings"  
published: 2013-07-19  
updated: 2013-07-19  
canonical: https://www.mindstick.com/forum/1342/wpf-datagrid-row-height  
category: "wpf"  
tags: ["wpf"]  
reading_time: 1 minute  

---

# WPF DataGrid row height

Hi [mindstick](https://yourviews.mindstick.com/view/84668/how-mindstick-is-used-for-marketing-purposes)!

I have a datagrid in a [WPF](https://www.mindstick.com/forum/304/wpf) [project](https://www.mindstick.com/articles/105927/how-to-excel-at-managing-multiple-projects),

ive set the columns width to be have maximun [limits](https://answers.mindstick.com/qa/34268/what-are-the-gov-limits-in-the-salesforce-com),

and i want the [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) to be stretched in the rows them [self](https://www.mindstick.com/articles/44535/smart-ways-to-secure-self-storage-facilities) but that doesnt happends...

they just stay as they are and the cell is cuted...

any [ideas](https://www.mindstick.com/articles/43878/making-the-best-use-of-the-options-trade-ideas) ?

**Here is the [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) :**

```
<DockPanel><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">        <DataGrid.Style>            <Style>                <Setter Property="ScrollViewer.CanContentScroll" Value="False" />            </Style>        </DataGrid.Style>        <DataGrid.Columns >            <DataGridTextColumn Binding="{Binding Path=task_desc}" IsReadOnly="True" Header="test1" Width="SizeToCells" MaxWidth="330" >            </DataGridTextColumn>            <DataGridTextColumn Binding="{Binding Path=task_req_date}" IsReadOnly="True" Header="test2" Width="SizeToCells" MaxWidth="70" >            </DataGridTextColumn>            <DataGridTemplateColumn Header="delete" >                <DataGridTemplateColumn.CellTemplate>                    <DataTemplate>                        <Button Content="delete" ToolTip="delete" Opacity="0.8" Click="Button_Click" MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave">                            <Button.Template>                                <ControlTemplate>                                    <Border HorizontalAlignment="Center" VerticalAlignment="Center">                                        <Image Source="/exhibits;component/Images/exit1.png" Width="15" Height="15" />                                    </Border>                                </ControlTemplate>                            </Button.Template>                        </Button>                    </DataTemplate>                </DataGridTemplateColumn.CellTemplate>            </DataGridTemplateColumn>        </DataGrid.Columns>    </DataGrid>
```

thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)

## Replies

### Reply by shreesh chandra shukla

Solution!

try using the TextBlock I belive it should automatically wrap to your size

```
 
<DataGridTemplateColumn Width="*" Header="Column
2">           
<DataGridTemplateColumn.CellTemplate>               
<DataTemplate>                   
<TextBlock Text="{Binding Path=task_req_date}""
TextWrapping="Wrap" />                 
<DataTemplate>           
<DataGridTemplateColumn.CellTemplate>       
</DataGridTemplateColumn>
```


---

Original Source: https://www.mindstick.com/forum/1342/wpf-datagrid-row-height

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
