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?
The VisibleDates is a collection of the Dates displayed by the control. It is updated as the view changes and the collection can be manipulated to affect the current view control. It is not a bindable property because the control needs to manipulate it based on the navigation. You were asking about changing the view to a single day in which case when you change the view to DayViewDay you could also remove all the dates from the VisibleDates collection except 1. You could do this in your own attached behavior if you wanted.
CurrentViewDateRange is just a range comprising the earliest and latest dates in the visible dates and is for informational purposes. The visible dates can contain discontiguous days/weeks just as you can do in Outlook.
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:
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>
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.
I am sorry, there is a SelectedDates property, but it is not bindable.