Hi!
I am a newbie to Csla, but I think at work I have gotten a good impression on how everything is working togeteher. Now I am trying to sort a WPF DataGrid with the SortedBindingList. I achieved a Custom sorting with it and I am quite happy with the solution but I have got a question.
In my Application I have a column with dates. Some of these dates maybe the same dates (e.g. 23.3.2008 for 3 times). When I apply the sort with this property it seems that the list is taking another property to decide in which order these dates should be shown. Is the list really taking another property into sorting? Or is it just luck that this is sorted the right way?
Can I somehow take influence in the sorting when dates are the same? Like saying if dates are the same, take the property ID as second sorting-parameter?
If
you follow the pattern and expose the date as string, you are sorting on string
value of a date, so 1/1/2009 will come after 9/9/2008. For date sorting I
usually add a read only property that returns the date, and sort on that
property instead of date.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: Woggly
[mailto:cslanet@lhotka.net]
Sent: Wednesday, April 01, 2009 8:09 AM
To: Sergey Barskiy
Subject: [CSLA .NET] SortedBindingList Question
Hi!
I am a newbie to Csla, but I think at work I have gotten a good impression
on how everything is working togeteher. Now I am trying to sort a WPF DataGrid
with the SortedBindingList. I achieved a Custom sorting with it and I am quite
happy with the solution but I have got a question.
In my Application I have a column with dates. Some of these dates maybe the
same dates (e.g. 23.3.2008 for 3 times). When I apply the sort with this
property it seems that the list is taking another property to decide in which order
these dates should be shown. Is the list really taking another property into
sorting? Or is it just luck that this is sorted the right way?
Can I somehow take influence in the sorting when dates are the same? Like
saying if dates are the same, take the property ID as second sorting-parameter?
That is not what I mean. The sorting does work. But I would like to know if the list is taking a second property if the first one is doubled to sort.
Can I somehow take influence in the sorting when dates are the same? Like saying if dates are the same, take the property ID as second sorting-parameter?
I
think the book describes how to add a custom delegate to the sorted binding
list. On the other hand, it is much easier to use Linq to CSLA instead of
sorted binding list.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: Woggly
[mailto:cslanet@lhotka.net]
Sent: Wednesday, April 01, 2009 10:00 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: SortedBindingList Question
That is not what I mean. The sorting does work. But I would like
to know if the list is taking a second property if the first one is
doubled to sort.
Can I somehow take influence in the sorting when dates are the same? Like
saying if dates are the same, take the property ID as second sorting-parameter?
Woggly:That is not what I mean. The sorting does work. But I would like to know if the list is taking a second property if the first one is doubled to sort.
Can I somehow take influence in the sorting when dates are the same? Like saying if dates are the same, take the property ID as second sorting-parameter?
I tried it with Linq first, but the list was not sorted correctly. It only took the first two characters of the date and sorted them, something like this was the result:
23.08.2008
23.04.2008
23.01.2009
23.05.2008
But I will have another look at it, perhaps I did something wrong.
Copyright (c) Marimer LLC