The following quick start guide is intended to get you up and running with Scheduler for WPF. In this quick start you'll create a new Expression Blend project, add Scheduler to your application, bind to a data source, and customize the schedule.
or
Add the NuGet packages by following these steps:
XAML |
Copy Code
|
---|---|
<c1:C1Scheduler x:Name="scheduler"></c1:C1Scheduler> |
C# |
Copy Code
|
---|---|
using C1.C1Schedule; using System.Windows.Controls; using ProjectNAME.C1NWindDataSetTableAdapters; |
Note that the using statement should contain the name of your project in order to work correctly. It will be used to set up the table adapter for your data set. The Imports statement should be used for Visual Basic projects.
C# |
Copy Code
|
---|---|
public partial class MainWindow : Window { private AppointmentsTableAdapter _appointmentsTableAdapter; private AppointeesTableAdapter _appointeesTableAdapter; private C1NwindDataSet _dataSet; public C1NwindDataSet DataSet => _dataSet; public MainWindow() { InitializeComponent(); _dataSet = new C1NwindDataSet(); _appointeesTableAdapter = new AppointeesTableAdapter(); _appointmentsTableAdapter = new AppointmentsTableAdapter(); _appointmentsTableAdapter.Fill(_dataSet.Appointments); _appointeesTableAdapter.Fill(_dataSet.Appointees); } } |
Map the database to the Appointment Storage by adding the following XAML code between the <c1:C1Scheduler>
</c1:C1Scheduler>
tag or adding the following C# code in the MainWindow() constructor:
XAML |
Copy Code
|
---|---|
<c1:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.DataMember" Value="Appointments"/> <c1:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.DataSource" Value="{Binding DataSet, RelativeSource={RelativeSource AncestorType=local:DataSourceBinding, Mode=FindAncestor}}"/> <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:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.IndexMapping.MappingName" Value="N/A"/> |
C# |
Copy Code
|
---|---|
// set mappings and DataSource for the ContactStorage ContactStorage cstorage = scheduler.DataStorage.ContactStorage; cstorage.Mappings.IndexMapping.MappingName = "EmployeeID"; cstorage.Mappings.TextMapping.MappingName = "FirstName"; cstorage.DataMember = "Appointees"; cstorage.DataSource = _dataSet.Appointees; // set mappings and DataSource for the AppointmentStorage AppointmentStorage storage = scheduler.DataStorage.AppointmentStorage; storage.Mappings.AppointmentProperties.MappingName = "Properties"; storage.Mappings.Body.MappingName = "Body"; storage.Mappings.End.MappingName = "End"; storage.Mappings.IdMapping.MappingName = "Id"; storage.Mappings.Location.MappingName = "Location"; storage.Mappings.Start.MappingName = "Start"; storage.Mappings.Subject.MappingName = "Subject"; storage.DataMember = "Appointments"; storage.DataSource = _dataSet.Appointments; DataContext = this; |
Now that you've created a scheduler application and bound the schedule to a data source, the only thing left to do is run the application.
To run the schedule application and observe Scheduler for WPF's run-time behavior: