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

Syncing daytemplate selector with ObservableCollection (MVVM)

1 Answer 65 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Thomas Garp
Top achievements
Rank 1
Thomas Garp asked on 04 Jun 2013, 11:10 AM

Hi telerik support

I have a changing observable list of dates on my viewmodel, and I would like to highlight the days within that collection.

I have tried to implement my own DataTemplateSelector for the dayTemplateselector and I have managed to get the dates from my CollectionViewSource, but it seems that it only works on static data and the changes made to my collection does not appear in the Calendar.

How can I archive binding between the daytemplateSelector and my observableCollection?

1 Answer, 1 is accepted

Sort by
0
Ivo
Telerik team
answered on 07 Jun 2013, 01:49 PM
Hi Thomas,

Changes made into your ObservableCollection are not affected into the RadCalendar because the SelectTemplate method into your custom DayTemplateSelector is called only while the control is being rendered. There is an easy way to workaround this however it is a little hacky. You can pass the RadCalendar control to your DayTemplateSelector and reset its template every time when the ObservableCollection changes. You can find attached a sample project that demonstrates this approach.

Regards,
Ivo
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Calendar
Asked by
Thomas Garp
Top achievements
Rank 1
Answers by
Ivo
Telerik team
Share this question
or