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.
Hi Georgi,
Thanks for your help.
I applied your suggested fixes and they both worked.
Unfortunately I still have a problem. I need to display the time as well as the date. It guess your DateColumn is based on the sdk:DatePicker control. This only has two options for format - "Short" or "Long", which both only display the date. Is there any way to display both dates AND times in the xamGrid?
Hi,
I believe your first issue is a bug in the control that was fixed a while ago. Upgrading to the latest SR should fix the problem.
As for the second one, you can set an EditorStyle on the column and set the SelectedDateFormat property of the date picker in this style:
<Style x:Key="LongDateStyle" TargetType="sdk:DatePicker"> <Setter Property="SelectedDateFormat" Value="Long" /> </Style>
<ig:XamGrid> <ig:XamGrid.Columns> <ig:DateColumn Key="LongDateTime" EditorStyle="{StaticResource LongDateStyle}" /> </ig:XamGrid.Columns> </ig:XamGrid>
In 11.1, we're adding the SelectedDateFormat property on the DateColumn, which should make this easier.
Hope this helps,