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

Collection of selected dates

3 Answers 87 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Dan Weese
Top achievements
Rank 1
Dan Weese asked on 17 Mar 2010, 10:09 PM
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.

3 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 18 Mar 2010, 05:37 PM
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.
0
Dan Weese
Top achievements
Rank 1
answered on 18 Mar 2010, 08:17 PM
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;

0
Hristo
Telerik team
answered on 19 Mar 2010, 10:45 AM
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.
Tags
Calendar
Asked by
Dan Weese
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Dan Weese
Top achievements
Rank 1
Share this question
or