Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1235
How do I databind the visible dates?
posted

Hi, since I use MVVM I would like to databind the SelecttedDates property from my ViewModel class.
Apparently there is no such  possibility.
Being accustomed to use the CalendarInfo I would have expected a similar functionality: one single place to select a single date, a continous daterange, or a List<DateRange>. Then the various controls (XamDayView, XamMonthCalendar) would reflect automatically those changes in the VisibleDates and SelectedDates respectively.
Is there a way to obtain such functionality?
Best Regards 

  • 54937
    Offline posted

    XamMonthCalendar is not related to the xamSchedule controls. With regards to its SelectedDates collection that is not an indication of what is in view - it is just a list of the dates that are currently selected. This is the same as the SelectedItems of a Selector which is not bindable. If you wanted to synchronize this with your viewmodel then you would have to write your own attached property that would hook the CollectionChanged of the control's SelectedDates and the CollectionChanged of your collection and keep the two in sync. XamMonthCalendar does not expose a collection of visible dates - basically depending on its settings it will show 1 or more groups relative to its ReferenceDate and as you zoom in/out or scroll the dates in view can be changed.