ComponentOne Scheduler for WPF and Silverlight
Using the C1Calendar Control / Binding Schedule to a Calendar Control
In This Topic
    Binding Schedule to a Calendar Control
    In This Topic

    The C1Calendar control 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 C1Calendar, 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 C1Calendar control.

    XAML
    Copy Code
    <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/Schedule">
    
    <Grid>
      <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
      </Grid.ColumnDefinitions>
      <c1: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}}">
         <c1:C1Scheduler.CalendarHelper>
               <c1:CalendarHelper WeekStart="Sunday" EndDayTime="18:20:00" StartDayTime="09:20:00"
                    WorkDays="Tuesday,Wednesday,Friday,Saturday">
                    <c1:CalendarHelper.Holidays>
                         <System:DateTime>2007-11-02</System:DateTime>
                    <c1:CalendarHelper.Holidays>
               <c1:CalendarHelper>
         <c1:C1Scheduler.CalendarHelper>
      <c1:C1Scheduler>
    
      <c1:C1Calendar 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" >
         <c1:C1MultiMonthCalendar>
    </Grid>
    </Window>
    

     

    If several dates are selected in the C1Calendar, the C1Scheduler control changes to show the selected dates.