|
-
Jan 24th, 2014, 08:25 PM
#1
[RESOLVED] WPF - XAML - XamDataGrid - How to sort by Date Field?
Code:
<Custom:XamDataGrid.FieldLayouts>
<Custom:FieldLayout Key="masterRow">
<Custom:FieldLayout.SortedFields>
<Custom:FieldSortDescription Direction="Ascending" FieldName="ClosingDate"/>
</Custom:FieldLayout.SortedFields>
...
I'm sorting by some fields correctly, by doing this the user can simply click the Column header and the column is sorted. The problem appears with date fields, it's using the date as a string for sorting, like:
01/09/2013
02/02/2012
04/12/2013
05/01/2012
...
So, is there any way to use a formatted date value for sorting (like format "YYYYMMDD"), or maybe using a converter and applying it into XAML? What's the best solution for this problem?
-
Jan 25th, 2014, 12:45 AM
#2
Re: WPF - XAML - XamDataGrid - How to sort by Date Field?
How are you sorting? Mine works but my format is
Code:
<GridViewColumn DisplayMemberBinding=
"{Binding Path=ExpDate, StringFormat='MMM. dd, yyyy'}"
Header="Exp. Date" Width="110"/>
-
Jan 25th, 2014, 11:58 AM
#3
Re: WPF - XAML - XamDataGrid - How to sort by Date Field?
Hey dee-u. Actually i'm not Binding or applying format because i didn't want to affect how the date is being displayed i want to keep showing format "DD/MM/YYYY" but i want sorting to sort correctly according to date (the format needed for this would be "YYYYMMDD"), is this possible using your code? Showing a date format but sort using another?
This grid comes with Infragistics.
EDIT:
It's resolved now, i had to use EditAsType using type Datetime. For some reason this field was formatted as String and that's why it was being sorted by the grid like a String.
Last edited by jcis; Jan 29th, 2014 at 08:42 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|