Linking a Scheduler to a Calendar
The following topic explains how to bind a schedule to a C1MonthCalendar 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 C1MonthCalendar 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 C1MonthCalendar control you added to the window.
4. In the Properties panel of Design view, click the Advanced Property Options button next to the C1MonthCalendar.DateTime 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:
<c1sched:C1MonthCalendar HorizontalAlignment="Left" Margin="8,23,0,204" Width="217" DateTime="{Binding Path=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 C1MonthCalendar control:
1. Add a C1Scheduler and C1MonthCalendar 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 C1MonthCalendar control you added to the window.
5. In the XAML window, find the <my:C1MonthCalendar /> XAML.
6. Edit the XAML so it looks similar the following:
<my:C1MonthCalendar HorizontalAlignment="Left" DateTime="{Binding Path=SelectedDateTime, ElementName=C1Scheduler1, Mode=TwoWay}" Height="159" Margin="0,20.04,0,0" VerticalAlignment="Top" Width="182" />
7. Press F5 to run the project and select a date in the C1MonthCalendar. The schedule’s selected date will change accordingly.
Using XAML
The following XAML binds C1Scheduler to a C1MonthCalendar control:
<my:C1MonthCalendar HorizontalAlignment="Left" DateTime="{Binding Path=SelectedDateTime, ElementName=C1Scheduler1, Mode=TwoWay}" Height="159" Margin="0,20.04,0,0" VerticalAlignment="Top" Width="182" />
|