I would be useful for MVVM to be able to bind the VisibleDates property to an ObservableCollection. Any reason why this can't be done?
Hello Geoff,
I have been looking into your request and although I am not quite sure what you mean by that I doubt that it is impossible. Usually this is a read-only property which gives you access to the days within the control and like other functionality and feature is decided on based mostly on popular demand along with other implementation criteria.
Here is the page where all our clients can influence/contribute to our product line: http://devcenter.infragistics.com/Protected/RequestFeature.aspx . If your suggestion is picked up for development you’ll be notified with an email.
Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Hi Petar,
I totally agree with jifman.
We certainly need a bindable VisibleDates property. Of course the primary use for this control is to let the user pick its dates. Nonetheless in my application I already have at least 2 different situations in which I need to synchronize the date between the XamMonthCalendar and XamDayView from code:
1) I want to display the next 5 working days for a resource owner (if the owner works only on Wednesday, it means showing 5 Wednesdays (the can even reside in non consecutive weeks ). In this case I want to force the selection of discontinous dates. It doesn't make sense to show a working week. I need to set those dates from code, and since I use MVVM, not from code behind.
2) In another section (outside the schedule) of the program I can see the next appointments of the patient. The user must be able to double click on one of this reminders and force the agenda to open up with pre-selection a particular date/owner.Best regardsRoberto Dalmonte
Can you clarify what exactly you are looking for. XamMonthCalendar was not part of this discussion and it doesn't really make a lot of sense for xamMonthCalendar to expose a VisibleDates collection since the number of dates it can show can be great and because you can zoom out to the point that you show decades at which point what would the visible dates include. With regards to the xamSchedule controls it doesn't make sense to have a single VisibleDates collection on the datamanager because you can have multiple controls that are showing different dates or overlapping dates (e.g. monthview shows multiple weeks and day/schedule view showing 1 or more days). You could even have non-calendar type view controls (e.g. a grid) whose information comes from the datamanager. For the individual controls the VisibleDates property itself cannot be a DP. The control needs to be able to modify and control the collection based on its constraints. A binding DP would mean that you would set the Collection instance that it would use. As I mentioned it is possible for someone to create an attached behavior that keeps the VisibleDates collection of one control in sync with a given collection provided by the viewmodel but the exact behavior/requirements may be different for different developers in different scenarios and doing this wouldn't make sense if you were using multiple view controls (e.g. a day view, a schedule view and a monthview) as they wouldn't have the same values in their collection so what would be the result of the synchronization.
With regards to some form of synchronization/communication between what is selected in a xamMonthCalendar and what is shown by the xamSchedule controls that makes sense and was something that we considered but was not part of the initial release. There are still similar questions as to what should happen when using multiple view controls that could be showing a different # of days. I've attached a basic example of using a custom attached behavior to facilitate synchronized selection between a WPF/SL Calendar and a single xamSchedule control. Note I used the intrinsic Calendar control so the sample would work for both WPF & SL. You could write a similar attached behavior to synchronize the VisibleDates of the control with a property on your viewmodel.