Hi, I am using a xamGrid in Silverlight.
I am using auto-generate columns.
One of my columns is a DateColumn, its data source is .Net DateTime object.
There are 2 problems -
1)
The column displays correctly at first with little calendars in each cell of the date column.
But if you scroll the grid the date displayed on each calendar loses its value and gets displayed as D/MM/yy.
2)
How do I format the date column? All of the samples I could find on the web refered to TextColumn and FormatString which is not available for DateColumn.
I don't want to convert to text as I want to use a filter on the column and this won't work if the column is treated as text.
Kind Regards, David.
When you do this, what is required in order to maintain sorting and filtering capabilities for dateTime?
If you derive a column from DateColumn and and Provider from DateColumnContentProvider and use even a standard datepicker binding in ResolveDisplayElement and return the datePicker in ResolveEditorControl, the sorting seems to be broken and the filtering for specialized filters for things like contains, and not equals appears to be broken as well.
What is the approach one is supposed to take for implementing this custom dateColumn so that things like sorting and filtering stay intact?
Is there any progress on this front? We need the same functionality of having both date and time displayed.
Many people store a date and time together in one column. Having to create a custom column for that sounds like a major oversight in the development of xamGrid. The library should have a setting for DateTime columns that specifies whether it is just a Date, or a Date and a Time (or perhaps just a time). An editor for each should be built in. Perhaps the setting should be a DateTimeFormatInfo that would override the default culture settings?
At the very least, please provide a link to all of the necessary code so lots of time :-) can be saved.
thanks for your help Gerogi
Hi David,
Your guess is correct - the DateColumn uses a DatePicker control for displaying and editing the values.
What you can do is to implement your own DateTimePicker control and use it for displaying and editing datetime values in XamGrid. You can create a custom column that inherits from DateColumn and extend it to use your custom control for this purpose.
Here's an article on how to create a custom column:
http://blogs.infragistics.com/blogs/devin_rader/archive/2010/07/08/creating-custom-columns-for-xamgrid.aspx
Basically, you'd want to create a custom column, deriving from DateColumn, and custom ColumnContentProvider deriving from DateColumnContentProvider.
Then, you'll need to override the ResolveDisplayElement and ResolveEditorControl methods in your derived ColumnContentProvider to return your custom DateTimePicker control.
Hope this helps,