WPF Quick Start > Step 2 of 4: Binding C1Scheduler to a Data Source |
Now you can add a C1Scheduler control to the Blend project and bind to the data source.
To add the new dataset as a resource to your Blend project:
xmlns:local="clr-namespace:MYProjectNAME"
Your XAML should look similar to the following:
XAML |
Copy Code
|
---|---|
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="MYProjectName.Page1" Title="Page1" xmlns:c1sched="http://schemas.componentone.com/wpf/Schedule" x:Class=”WpfScheduleQuickStart.Page1” xmlns:local="clr-namespace:MYProjectName"> |
XAML |
Copy Code
|
---|---|
<Page.Resources> <local:ScheduleDataSet x:Key="dataSet" /> </Page.Resources> |
To map to the Scheduler for WPF Data Storage:
Property |
Text |
Body |
Body |
End |
End |
Location |
Location |
Start |
Start |
Subject |
Subject |
AppointmentProperties |
Properties |
IdMapping |
Id |
IndexMapping |
|
XAML |
Copy Code
|
---|---|
<c1:C1Scheduler HorizontalAlignment="Left" Height="400" VerticalAlignment="Top" Width="480"> <c1sched:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.DataMember" Value="Appointments"/> <c1:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.DataSource" Value="{DynamicResource dataSet}"/> <c1:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.Body.MappingName" Value="Body"/> <c1:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.End.MappingName" Value="End"/> <c1:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.Location.MappingName" Value="Location"/> <c1:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.Start.MappingName" Value="Start"/> <c1:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.Subject.MappingName" Value="Subject"/> <c1:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.AppointmentProperties.MappingName" Value="Properties"/> <c1:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.IdMapping.MappingName" Value="Id"/> <c1:C1Scheduler> |
You have successfully bound C1Scheduler to a data source. Now you can customize the schedule.