This is a migrated thread and some comments may be shown as answers.

Custom Sort GroupDescriptors

7 Answers 136 Views
JumpList
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vivek
Top achievements
Rank 1
Vivek asked on 02 May 2012, 10:01 AM
While SortDescriptors specify how to sort the items within the JumpList, is there a way i could specify how to sort the groups.
For example:
a
1,2,3
x
4,5,6
b
1,4,5

How can I specify I need my groups to be displayed in the order {a, x, b}?

7 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 04 May 2012, 07:36 AM
Hello Vivek,

Yes, there is a way to implement this scenario. One possible way would be to first sort the items by using the key that you will later group by. In this way the groups will be created in the order the items were sorted initially and you will get the desired result. When sorting, you will also need to implement the IComparable interface in your business objects and provide the proper comparison logic so that you make x<b.

Let me know in case you have further questions or need assistance.

Regards,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Eugene
Top achievements
Rank 1
answered on 28 Jan 2014, 10:23 PM
Reviving an old post.

So the item sorting solution would work if the items never move within groups. In my case, I actually have a case where the items may move from one group to another, and I need the groups sorted. How would I implement that?
0
Victor
Telerik team
answered on 03 Feb 2014, 08:29 AM
Hi Eugene,

Your group descriptors should have a SortMode property. You can set it to make sure that your groups are always sorted in some order.

Please write again if you have other questions.

Regards,
Victor
Telerik
If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
0
Eugene
Top achievements
Rank 1
answered on 03 Feb 2014, 08:35 AM
SortMode only allows Ascending or Descending, from what I can tell. Really, a GroupDescriptor should be derived from IComparable<GroupDescriptor>, and allow overriding of the Compare operator. That would be a more .NET way of structuring this API.

But short of that, any other solutions?

Thanks!
0
Deyan
Telerik team
answered on 06 Feb 2014, 08:46 AM
Hello Eugene,

Actually sorting can be either ascending or descending. The groups in either case are sorted based on the value of the group key. So, if you want to have custom sorting approach, you can define a generic group descriptor that returns  a composite object instead of a string for the group key. That composite object implements IComparable and overrides Equals. If you have some code to share I can help you by implementing this for you.

Hope this helps.

Regards,
Deyan
Telerik
If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
0
Asdrúbal
Top achievements
Rank 1
answered on 14 Apr 2014, 10:46 PM
Hi,

The composite object + IComparable + override Equals works great for custom sorting group descriptor!

But... now I having this problem, I the base.ToString() text of the composite Object in design mode, not the overridden ToString() for the class

Dont get me wrong, It works great at run time, its in design mode the problem (Blendability issues)

Thanks










0
Deyan
Telerik team
answered on 17 Apr 2014, 08:49 AM
Hi Asdrubal,

You can perform a check to see if your component is currently in design mode or not:

if (DesignerProperties.GetIsInDesignMode(this))
       {
           // Design-mode specific functionality
       }


Regards,
Deyan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
JumpList
Asked by
Vivek
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Eugene
Top achievements
Rank 1
Victor
Telerik team
Asdrúbal
Top achievements
Rank 1
Share this question
or