We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting Default Row Height through XAML (NOT CODE)

Thread ID:





94510 May 18,2010 01:40 PM UTC Feb 17,2011 10:31 AM UTC WPF 7
Tags: GridControl
Andre Slenko
Asked On May 18, 2010 01:40 PM UTC

I would like to be able to set default row height and default column header height through XAML, not code.
I know in code you can use something like this:
this.grid.Model.RowHeights.DefaultLineSize = 20d; //row height

Ganesan K [Syncfusion]
Replied On May 20, 2010 04:21 AM UTC

Hi Andre,

Setting DefaultLineSize via Xaml is not possible, but we can acheive this by using attached property.

1.Create the attached property as follows.


public static readonly DependencyProperty RowHeightProperty = DependencyProperty.RegisterAttached(
"RowHeight", typeof(double), typeof(A) ,new FrameworkPropertyMetadata(32.0, OnRowHeightsChanged));

2.Set this property in the xaml like below.



3.Use the following code in OnRowHeightsChanged.

var datagrid = d as GridDataControl;
datagrid.Model.RowHeights.DefaultLineSize =(double) args.NewValue ;

Download the workarond sample under the following location.


Please let us know if you need any more details.


Andre Slenko
Replied On May 20, 2010 12:25 PM UTC

Thank you for your response.
It seems to me that this property is such an essential part of the grid control, that there should NOT be any need for workarounds, it must be incorporated in the grid XAML. It would be nice to see this implemented in the future versions.
How do you set the height of the column header row?

Ganesan K [Syncfusion]
Replied On May 21, 2010 08:52 AM UTC

Hi Andre,

Thanks for your feedback. We have forwarded the request to our development team to include this property in our future versions.

You can use the following code to set height of the column header row.

datagrid.Model.RowHeights[0] = 30;

Please let us know if you need any further details.


Andre Slenko
Replied On May 24, 2010 09:18 PM UTC

Thanks, that worked!

Varun P [Syncfusion]
Replied On May 25, 2010 10:12 AM UTC

Hi Andre,

We are glad that it worked on your side.

Please let me know if you have any queries.


Abhishek Joshi
Replied On February 11, 2011 07:09 AM UTC


Is this property available in the latest 9.1 release? It looks a lot of unnecessary work just for setting row height!!


Rajasekar [Syncfusion]
Replied On February 17, 2011 10:31 AM UTC

Hi Abhishek,

Thanks for your update.

In current version(v9.1.0.20) we don’t have support for setting the row height in XAML. In code behind you can set the row height as stated above, but if you want set in XAML means you can set through Attached property.

Please let us know if you have any queries.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon