Collection of selected dates

4 posts, 0 answers
  1. Dan Weese
    Dan Weese avatar
    16 posts
    Member since:
    Sep 2009

    Posted 17 Mar 2010 Link to this post

    I have a RadCalendar set to show 3 rows (months) and SelectionMode is set to Multiple. When you click the days, they highlight, which is great. How do I get the collection of selected dates, and on what event is a day added to the collection? I want to populate a listbox with the selected dates in date order each time a day is selected or unselected.
  2. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 18 Mar 2010 Link to this post

    Hi Dan Weese,

    You could use radCalendar.SelectedDates property and give it directly as source for the LIstBox.
    This way the listbox will be populated with the selected dates.
    You could use also SelectionChanged event to know when selected dates change.

    Let us know if you need more help.

    Best wishes,
    Hristo
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Dan Weese
    Dan Weese avatar
    16 posts
    Member since:
    Sep 2009

    Posted 18 Mar 2010 Link to this post

    OK, that's working, but is there a good way to sort the SelectedDates property by date order?

    I'm using this currently:

     

    var srtList = radCalendarSelectDays.SelectedDates.ToList();

     

    srtList.Sort((a, b) => a.Date.CompareTo(b.Date));

    listBoxSelectedDays.ItemsSource = srtList;

  5. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 19 Mar 2010 Link to this post

    Hi Dan Weese,

    There is nothing wrong with your approach but you could use CollectionViewSource to get the default view and add SortDescription. Then you could bind the default view to the listbox and you will get out of the box sorted dates in the listbox.

    Let us know if you have trouble implementing this functionality.

    Kind regards,
    Hristo
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top