Hello,
I have a date column in my dataSource with date and time. But in my XamDataGrid it showed only with date without time. How can i set it to show time also?
Hello michaelgr12345,
I would recommend using a xamDateTimeEditor as the editor for the column. Then you could set the Mask property to something like {date} {time} or yyyy/mm/dd hhhh:mm, depending on your date and time formats.
About Masks
Using xamDateTimeEditor as a Field in XamDataGrid
XamDateTimeEditor Class API
Elizabeth AlbertLocalization Engineer
can you give me an example how to do it in code?
for example if i have a column named stepStartTIme and i want to display it with date and Time
Please find the attached sample where I set the Mask property of the editor. If you want to customize the shown data only when you are not in edit mode you should set the same value to the Format property.
If you need any additional assistance on the matter I will be glad to help.
OK. and how can i do it in code? no in xaml
Hi michaelgr12345,
To change the date time format in the XamDateTimeEditor form code behind you should set the EditorStyle property of the column in the XamDataGrid that contains this editor. You can try the following approach:
Style style = new Style(typeof (XamDateTimeEditor));
style.Setters.Add(new Setter(XamDateTimeEditor.MaskProperty, "dd/mm/yy hh:mm:ss"));
Resources.Add(typeof (XamDateTimeEditor), style);
grid1.FieldLayouts[0].Fields[0].Settings.EditorType = typeof(XamDateTimeEditor);
grid1.FieldLayouts[0].Fields[0].Settings.EditAsType = typeof(DateTime);
grid1.FieldLayouts[0].Fields[0].Settings.EditorStyle = style;
If you have any additional questions or concerns do not hesitate to ask.
I am just cheking have you been able to resolve your issue. If you need any futher assistance I will be glad to help.
If the above suggestion helped you solve your issue please veritify the thread as answered, so other users may take better advantage of it.
Hi Elena,
How to include Milliseconds also in the DateTime displayed in the grid?
Thanks,
Poornima
Hello Maya,
Thank you for your post. I have been looking into it and I can suggest you see this forum thread:
http://ko.infragistics.com/community/forums/t/74229.aspx
where a similar question is already discussed.
hello Elena
I've tried using your example with the format dd-MMM-yy (18-Jun-2014) and received empty DateTime cells in the grid.
Is this format unsupported by the XamDateTimeEditor?
thank you
maya
Hello Poornima,
In order to show the milliseconds you can just add some “f”s in the end of your mask definition. For further reference please check the following link from msdn:
http://msdn.microsoft.com/en-us/library/bb882581.aspx