Binding Schedule to a Calendar Control
The C1MonthCalendar and C1MultiMonthCalendar controls can be used to provide navigation and additional information for a C1Scheduler control. This can be done by binding control properties.
C1MonthCalendar/C1MultiMonthCalendar Property |
C1Scheduler Property |
Comments |
CalendarHelper |
CalendarHelper |
Binding these properties keeps the culture and calendar-dependant properties used by both controls in sync. This is important for default navigation. |
VisibleDates |
SelectedDates |
Binding these properties allows the C1Scheduler control to be navigated when a user selects days in a calendar. For example, if you select four days in the C1MonthCalendar, those four days will be shown in the C1Scheduler control. |
BoldedDates |
BoldedDates |
Binding these properties makes days with appointments bold in a calendar control. |
For example, the following XAML binds C1Scheduler to a C1MultiMonthCalendar control.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:System="clr-namespace:System;assembly=mscorlib"
x:Class="UntitledProject1.Window1"
x:Name="Window"
Title="Window1"
Width="924" Height="480" xmlns:c1sched="http://schemas.componentone.com/wpf/C1Schedule">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<c1sched:C1Scheduler Name="scheduler1" Grid.Column="1"
MonthStyle="{DynamicResource {ComponentResourceKey
TypeInTargetAssembly=c1sched:C1Scheduler, ResourceId=MonthStyle2007}}"
WeekStyle="{DynamicResource {ComponentResourceKey
TypeInTargetAssembly=c1sched:C1Scheduler, ResourceId=WeekStyle2007}}"
WorkingWeekStyle="{DynamicResource {ComponentResourceKey
TypeInTargetAssembly=c1sched:C1Scheduler, ResourceId=WorkingWeekStyle2007}}"
OneDayStyle="{DynamicResource {ComponentResourceKey
TypeInTargetAssembly=c1sched:C1Scheduler, ResourceId=OneDayStyle2007}}">
<c1sched:C1Scheduler.CalendarHelper>
<c1sched:CalendarHelper WeekStart="Sunday" EndDayTime="18:20:00" StartDayTime="09:20:00"
WorkDays="Tuesday,Wednesday,Friday,Saturday">
<c1sched:CalendarHelper.Holidays>
<System:DateTime>2007-11-02</System:DateTime>
</c1sched:CalendarHelper.Holidays>
</c1sched:CalendarHelper>
</c1sched:C1Scheduler.CalendarHelper>
</c1sched:C1Scheduler>
<c1sched:C1MultiMonthCalendar Name="calendar1" Margin="10,10,10,0"
Grid.Column="0" VerticalAlignment="Stretch" MaxSelectionCount="42"
SelectedDates="{Binding ElementName=scheduler1, Path=VisibleDates, Mode=OneWay}"
BoldedDates="{Binding ElementName=scheduler1, Path=BoldedDates, Mode=OneWay}"
CalendarHelper="{Binding ElementName=scheduler1, Path=CalendarHelper, Mode=OneWay}"
GenerateAdjacentMonthDays="true" >
</c1sched:C1MultiMonthCalendar>
</Grid>
</Window>
If several dates are selected in the C1MultiMonthCalendar, the C1Scheduler control changes to show the selected dates.
|