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?
What about supporting a WCF Data Services data source? And it would require a custom query.
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.
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
The ListScheduleDataConnector and WcfListScheduleDataConnector use Linq to query only the information that is needed so if your datasource is a linq enabled one (e.g. linq to sql) then only the information that is needed for the display will be loaded. If you wanted to try and manage this yourself then you would either write a custom dataconnector (which will be more involved but gives you control over providing the information that the datamanager is requesting on behalf of the controls with which it is associated) or you could hook the CollectionChanged of the VisibleDates of all the controls and aggregate them but I would make sure to do this asynchronously as the event could fire multiple times.
So it does...
how do you propose to retrieve the data as the user navigates to these new dates?
Is there an event to hook up?