Resort does not occur when item changes

3 posts, 1 answers
  1. John
    John avatar
    7 posts
    Member since:
    Nov 2011

    Posted 08 Mar 2012 Link to this post

    The ItemsSource property of my RadJumpList is bound to an ObservableCollection property called OC. Whenever an item contained in the ObservableCollection changes I make sure to call PropertyChanged("OC"). Since the RadJumpList is bound to the OC property, and I'm calling PropertyChanged("OC") on my object, the RadJumpList should update the list whenever an item in the ObservableCollection changes.

    This works correctly in all cases except for sorting. I'm sorting the RadJumpList by the Name property of the items contained in the ObservableCollection, but whenever the Name property changes and I call PropertyChanged("Name") the list does not resort. The list refreshes so that the new name is displayed, but it does not resort.

    Should resorting happen automatically? How can I force a resort programmatically?
  2. Answer
    Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 09 Mar 2012 Link to this post

    Hello John,

    Thanks for contacting us and for your question.

    If you are using a GenericSortDescriptor to sort RadJumpList, please make sure that you have initialized its KeyName property with the name of the property you are sorting by. For instance:

    GenericSortDescriptor<MyTestObject, string> sd = new GenericSortDescriptor<MyTestObject, string>();
    sd.KeyName = "Name";
    sd.KeySelector = (MyTestObject obj) =>
    {
        return obj.Name;
    };

    I hope this helps.

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

    Regards,
    Deyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. John
    John avatar
    7 posts
    Member since:
    Nov 2011

    Posted 09 Mar 2012 Link to this post

    That works perfectly. Thanks.
Back to Top