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.
Ok so I cannot do a binding for CurrentViewDateRange property. Is there a way for me to handle the VisibleDatesChagned event? Cause I dont see one now. I need to do something when the user changes the visible dates, either by selecting a new date from the date navigator, or by changing the view type or by simply scrolling in teh month view. I need to know when the Current Visible Dates are changed.
As an alternate, I thought I could use the DateNavigatorSelectedDates, but that does not have a SelectedDates proeprty, and i cannot use the values from the event args(addeditems and removed items)
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.
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.