Is there a way to default the date to today's date and remove the time (in red) in the add row section of the grid.
Thanks Georgi! Exactly what I'm looking for!
Hi,
The XamGrid exposes the DataObjectRequested event, which is raised when there's a necessity for a new object to be created (which is the case when you use the AddNewRow). This event is useful for cases when your underlying data objects do not have a default constructor (so the grid would not be able to create them on its own), or you want to set specific property values on these objects (as in your case - set the date to 'Today').
To eliminate the "Time" part in the Editor, you can use a TemplateColumn and set a StringFormat on the EditorTemplate.
Attached is a sample that demonstrates both approaches.
Hope this helps,
Thanks Petar! I'll just override the constructor.
Hello Marie,
I have been looking into your requirement, however I was not able to find another suggested approach for doing that. This is why I can suggest you learn how to override your constructor, or perhaps create a wrapper class in which you can do that. Besides from that I can create a Feature Request on your behalf so a more straight forward approach is provided by the XamGrid in one of our future releases.
Please let me know if I can be of any further assistance.
Hello Petar,
Sorry for the late response.
I could not get your solution to work. My data is coming from entity framework 4 and not sure how I can have it default the date like you have.