Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

VS2010 - DataGrid: How to center text vertically in DataGrid cells in a DataGridTextColumn

$
0
0

Hi all,

I'm using a DataGrid with DataGridTextColumns. To increase readability of the Grid I tried to use DataGrid.RowHeight=25. The text in the cells is displayed with VerticalAlignment="Top" of the TextBlock containing the text. This looks like this:

Obviously the TextBlock is stretched in its Grid cell by the default alignment. I tried to attach VerticalAlignment="Center" to the TextBlock via DataGrid.RowStyle and DataGrid.CellStyle w/o any success.

Any idea how to handle this? I know that using DataGridTemplateColumn could solve the problem but I would like to avoid this "mighty" alternative to solve this rather trivial requirement.


Regards Uwe


Viewing all articles
Browse latest Browse all 18858

Trending Articles