ComponentOne Scheduler for WPF and Silverlight
C1Scheduler Task-Based Help / C1Scheduler Tasks / Linking a Scheduler to a Calendar
In This Topic
    Linking a Scheduler to a Calendar
    In This Topic

    The following topic explains how to bind a schedule to a C1Calendar control in Microsoft Blend, Visual Studio, and using XAML.

    Using Microsoft Blend

    In Blend, linking C1Scheduler to one of the calendar controls is as easy as setting a property.

    1. Add a C1Scheduler and C1Calendar control to your window.
    2. Under Objects and Timeline, click scheduler1, and enter C1Scheduler1 as the name of the control. If necessary, select Window | Interaction to view Objects and Timeline.
    3. Select the C1Calendar control you added to the window.
    4. In the Properties panel of Design view, click the Advanced Property Options button next to the C1Calendar.SelectedDate property in the DateTime category.
    5. Select Custom Expression and enter the following expression:

      {Binding Path=SelectedDateTime, ElementName=C1Scheduler1, Mode=TwoWay}

      This will bind the selected date of the calendar to the schedule.

      The equivalent XAML code can be viewed by clicking the XAML view tab. It should look like the following:

      XAML
      Copy Code
      c1:C1Calendar HorizontalAlignment="Left" VerticalAlignment="Top" Theme="{DynamicResource {ComponentResourceKey ResourceId=Default, TypeInTargetAssembly={x:Type c1sched:CalendarBase}}}" SelectedDate="{Binding SelectedDateTime, ElementName=C1Scheduler1, Mode=TwoWay}">
      

                

    6. Press F5 to run the project and select a date in the calendar. The schedules selected date will change accordingly.

    Using Visual Studio

    To link C1Scheduler to a C1Calendar control:

    1. Add a C1Scheduler and C1Calendar control to your window.
    2. Select the C1Scheduler control.
    3. In the Properties window, enter C1Scheduler1 in the Name text box, if necessary.
    4. Select the C1Calendar control you added to the window.
    5. In the XAML window, find the <my:C1Calendar /> XAML.
    6. Edit the XAML so it looks similar the following:
      <c1:C1Calendar HorizontalAlignment="Left" Margin="34,51,0,0" Name="c1Calendar1" VerticalAlignment="Top" SelectedDate="{Binding Path=SelectedDateTime, ElementName=C1Scheduler1, Mode=TwoWay}"  />
      
    7. Press F5 to run the project and select a date in the C1Calendar. The schedule’s selected date will change accordingly.

    Using XAML

    The following XAML binds C1Scheduler to a C1Calendar control:

    <c1:C1Calendar HorizontalAlignment="Left" Margin="34,51,0,0" Name="c1Calendar1" VerticalAlignment="Top" SelectedDate="{Binding Path=SelectedDateTime, ElementName=C1Scheduler1, Mode=TwoWay}"  />