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.
Unfortunately, activation email could not send to your email. Please try again.

Setting Default Row Height through XAML (NOT CODE)

Thread ID:

Created:

Updated:

Platform:

Replies:

94510 May 18,2010 09:40 AM Feb 17,2011 05:31 AM WPF 7
loading
Tags: GridControl
Andre Slenko
Asked On May 18, 2010 09:40 AM

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 12:21 AM

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.

[C#]

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.

[Xaml]

x:Name="dataGrid"
AutoPopulateColumns="True"
AutoPopulateRelations="False"
local:A.RowHeight="200">

3.Use the following code in OnRowHeightsChanged.

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

Download the workarond sample under the following location.

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDCAttachedProperty1186167042.zip

Please let us know if you need any more details.

Thanks
Ganesan

Andre Slenko
Replied On May 20, 2010 08:25 AM

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 04:52 AM

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.

Thanks
Ganesan

Andre Slenko
Replied On May 24, 2010 05:18 PM

Thanks, that worked!

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

Hi Andre,

We are glad that it worked on your side.

Please let me know if you have any queries.

Thanks,
Varun

Abhishek Joshi
Replied On February 11, 2011 02:09 AM

Hi,

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

Thanks,
Abhishek


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

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.

Thanks,
Rajasekar



CONFIRMATION

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.

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.

;