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

DateTimeEdit and TimeSpanEdit in a GridTreeColumn

Thread ID:





109169 Jun 1,2013 03:20 PM UTC Aug 5,2013 08:39 AM UTC WPF 3
Tags: GridControl
Andreas Sommer
Asked On June 1, 2013 03:20 PM UTC

What is the best way to set a custom pattern format to a DateTimeEdit and TimeSpanEdit Column of a GridTreeControl? I did the following way, but it doesn't work:

new GridTreeColumn() { StyleInfo = new GridStyleInfo() { CellType = "DateTimeEdit", Format "dddd, dd.MM.yyyy hh:mm", HorizontalAlignment = HorizontalAlignment.Center

new GridTreeColumn() { StyleInfo = new GridStyleInfo() { CellType = "TimeSpanEdit", Format = " h 'h' m 'min'", HorizontalAlignment = HorizontalAlignment.Center }



Thangapriya V [Syncfusion]
Replied On June 4, 2013 06:59 AM UTC

Hi Andreas,

We have analyzed your query and you can set DateTimePattern as CustomPattern for using custom DateTime format. You can refer the following code snippet for this.

Code snippet [XAML]:

<syncfusion:GridTreeColumn MappingName="DOJ" HeaderText="DateTimeEdit">


                            <syncfusion:GridDataColumnStyle CellType="DateTimeEdit">


                                    <syncfusion:GridDateTimeEditStyleInfo  DateTimePattern="CustomPattern" CustomPattern="dddd, dd.MM.yyyy hh:mm"/>



                        </syncfusion:GridTreeColumn.StyleInfo>     </syncfusion:GridTreeColumn>



We have prepared a sample based on your requirement and please find the sample under the following location.

Please let us know if you have any queries.




Andreas Sommer
Replied On July 4, 2013 01:25 PM UTC

Sorry I need it by c# code not in XAML language. Thanks.

Thangapriya V [Syncfusion]
Replied On August 5, 2013 08:39 AM UTC

Hi Andreas,

Apologize for the delay caused. 

We suggest you to set CustomPattern for DateTimeEdit and TimeSpanEdit in code behind as follows.

Code snippet[C#]:

treeGrid.ModelLoaded += new EventHandler(treeGrid_ModelLoaded);

void treeGrid_ModelLoaded(object sender, EventArgs e)


GridTreeColumn column1 = new GridTreeColumn() { MappingName="DOJ", StyleInfo = new GridStyleInfo() { CellType = "DateTimeEdit", DateTimeEdit = new GridDateTimeEditStyleInfo() { DateTimePattern=DateTimePattern.CustomPattern, CustomPattern = "dddd, dd.MM.yyyy hh:mm" } } };


GridTreeColumn column2 = new GridTreeColumn() { MappingName = "Time", StyleInfo = new GridStyleInfo() { CellType = "TimeSpanEdit", TimeSpanEdit = new GridTimeSpanEditStyleInfo() { Format = " h 'h' m 'min'" } } };



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

This page will automatically be redirected to the 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