DateTimeEdit and TimeSpanEdit in a GridTreeColumn
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 }
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:GridTreeColumn.StyleInfo> <syncfusion:GridDataColumnStyle
CellType="DateTimeEdit"> <syncfusion:GridDataColumnStyle.DateTimeEdit>
<syncfusion:GridDateTimeEditStyleInfo DateTimePattern="CustomPattern"
CustomPattern="dddd, dd.MM.yyyy
hh:mm"/> </syncfusion:GridDataColumnStyle.DateTimeEdit> </syncfusion:GridDataColumnStyle> </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.
Regards,
Thangapriya
CellEditorsDemo_9d1b1b72.zip
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" } } }; treeGrid.Columns.Add(column1); GridTreeColumn column2 = new GridTreeColumn() { MappingName = "Time", StyleInfo = new GridStyleInfo() { CellType = "TimeSpanEdit", TimeSpanEdit = new GridTimeSpanEditStyleInfo() { Format = " h 'h' m 'min'" } } }; treeGrid.Columns.Add(column2); }
|
Please let us know if you have any queries.
Regards,
Thangapriya
- 3 Replies
- 2 Participants
-
AS Andreas Sommer
- Jun 1, 2013 03:20 PM UTC
- Aug 5, 2013 08:39 AM UTC