DayTemplateSelector not refreshed on binding change

2 posts, 0 answers
  1. Rob
    Rob avatar
    16 posts
    Member since:
    May 2014

    Posted 10 Jul 2014 Link to this post

    Hey,

    I am using a DayTemplateSelector to on my RadCalendar to show a different style for days that have appointments. With my test setup this works fine, but when I'm contacting a service to retrieve appointment, the collection is empty at the moment the month is switched and the appointments are added on arriving back from the service (one by one).

    The problem now is that the selector is not triggered when the binded property is changing. Is there a way to force a update on the selector?

    I found a post with the next solution:
    calendar.DisplayDate = calendar.DisplayDate.AddMonths(1);
    calendar.DisplayDate = calendar.DisplayDate.AddMonths(-1);

    BUT this will not work for me, when you change the mont the current date will be changed and I will retrieve a new list and the binded list is empty again. Why is the selector not listing to the changes of the property in the datacontext?
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 11 Jul 2014 Link to this post

    Hi Rob,

    The DataTemplateSelector doesn't get re-evaluated when a PropertyChanged notification is fired.
    This is a common issue, so I would suggest you go through these forum discussion, where several solutions are proposed:

    - http://social.msdn.microsoft.com/Forums/en-US/81e14539-c928-4879-bbb0-a1d3ef674130/wpf-reapply-datatemplateselector-when-a-certain-value-changes?forum=wpf

    - http://stackoverflow.com/questions/3543515/wpf-reapply-datatemplateselector-when-a-certain-value-changes

    Hope this helps.

    Regards,

    Konstantina
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top