When i switch the CurrentView between Week and Day View, the control still displays in the WeekMode, even though the CurrentViewMode of the XamOutlookCalendarView is set to OutlookCalendarViewMode.Day. Same behavior is observed when switching between ScheduleView to DayView.
However, if I switch from month view to day view, it works fine.
Please Suggest.
Thank You,
Hariharan
This is correct behavior. While in DayViewDay the control can display 1 or more days so we cannot assume that simply changing the CurrentView should change the visible dates because depending on the order of the code you have already changes the visible dates. You can either manipulate the VisibleDates directly or you can execute the XamOutlookCalendarViewChangeToDayViewCommand with the xamOutlookCalendarView as the parameter.
How do I set the visible dates? There is a CurrentViewDateRangeProperty that cannot be set , and I cant even bind to it with a oneway to source binding. Also the dateNavigator does not expose SelectedDates property . Is there a way for me to get the visible dates in xaml using bindings?
My mistake - I thought we exposed the VisibleDates but that is just maintained by each schedule control within the xamOutlookCalendarView. If you're using the xamOutlookCalendarView with a xamDateNavigator then you can listen for the SelectedDatesChanged of the xamDateNavigator and use the SelectedDates collection to get the dates since they will be synchronized.
I dont see a "SelectedDates" collection property exposed by the date navigator. There is a Selected Date, but thats just a single date.
I am sorry, there is a SelectedDates property, but it is not bindable.
Right it is not bindable just like the SelectedDates of the WPF Calendar or the SelectedItems of a a Selector (e.g. ListBox). You could probably write your own attached behaviour that hooks the CollectionChanged of the SelectedDates and of your collection and keeps the two in sync.
Why not use the commands for this type of action.
I had the same problem and start using the command because they do change the SelectedDates.
xmlns:igCommands="clr-namespace:Infragistics.Controls.Schedules.Primitives;assembly=InfragisticsWPF4.Controls.Schedules.v11.1" xmlns:igPrim="http://schemas.infragistics.com/xaml/primitives"
<Button Name="btnDayView" Content="Dag"> <ig:Commanding.Command> <igPrim:XamOutlookCalendarViewCommandSource CommandType="SwitchToDayView" TargetName="OutlookCalender1" EventName="Click" ></igPrim:XamOutlookCalendarViewCommandSource> </ig:Commanding.Command> </Button>
Sorry. I forgot about the Command.CommandTarget attached property so you could use that to provide the target if the object on which you're using the command source is outside the target control.
That is another alternative but then I believe you have to do one of the following: