DataSource.AppointmentsSource Property
Gets or sets a collection of objects containing appointment information. This is a dependency property.
Namespace: DevExpress.Xpf.Scheduling
Assembly:
DevExpress.Xpf.Scheduling.v24.1.dll
NuGet Package:
DevExpress.Wpf.Scheduling
Declaration
public object AppointmentsSource { get; set; }
Public Property AppointmentsSource As Object
Property Value
Type |
Description |
Object |
A collection of objects which contain appointment information.
|
The AppointmentsSource property supports the MVVM design pattern. See the MVVM Framework topic to learn more.
Example
View Example
using System;
using System.Collections.ObjectModel;
namespace SimpleSchedulingExample {
public class MainViewModel {
public virtual ObservableCollection<Doctor> Doctors { get; set; }
public virtual ObservableCollection<MedicalAppointment> Appointments { get; set; }
protected MainViewModel() {
CreateDoctors();
CreateMedicalAppointments();
}
private void CreateDoctors() {
Doctors = new ObservableCollection<Doctor>();
Doctors.Add(Doctor.Create(Id: 1, Name: "Stomatologist"));
Doctors.Add(Doctor.Create(Id: 2, Name: "Ophthalmologist"));
Doctors.Add(Doctor.Create(Id: 3, Name: "Surgeon"));
}
private void CreateMedicalAppointments() {
Appointments = new ObservableCollection<MedicalAppointment>();
Appointments.Add(MedicalAppointment.Create(
startTime: DateTime.Now.Date.AddHours(10), endTime: DateTime.Now.Date.AddHours(11),
doctorId: 1, notes: "", location: "101", categoryId:1, patientName: "Dave Muriel",
insuranceNumber: "396-36-XXXX", firstVisit: true));
}
}
}
<dxsch:SchedulerControl.DataSource>
<dxsch:DataSource AppointmentsSource="{Binding Appointments}" ResourcesSource="{Binding Doctors}">
<dxsch:DataSource.AppointmentMappings>
<dxsch:AppointmentMappings AllDay="AllDay"
Description="Notes"
End="EndTime"
Id="Id"
LabelId="CategoryId"
Location="Location"
RecurrenceInfo="RecurrenceInfo"
Reminder="ReminderInfo"
ResourceId="DoctorId"
Start="StartTime"
StatusId="StatusId"
Subject="PatientName"
Type="Type">
<dxsch:CustomFieldMapping Mapping="InsuranceNumber" Name="InsuranceNumber" />
<dxsch:CustomFieldMapping Mapping="FirstVisit" Name="FirstVisit" />
</dxsch:AppointmentMappings>
</dxsch:DataSource.AppointmentMappings>
<dxsch:DataSource.ResourceMappings>
<dxsch:ResourceMappings Caption="Name" Id="Id" />
</dxsch:DataSource.ResourceMappings>
</dxsch:DataSource>
</dxsch:SchedulerControl.DataSource>
public class MedicalAppointment {
public static MedicalAppointment Create() {
return ViewModelSource.Create(() => new MedicalAppointment());
}
internal static MedicalAppointment Create(DateTime startTime, DateTime endTime,
int doctorId, string notes, string location, int categoryId, string patientName,
string insuranceNumber, bool firstVisit) {
MedicalAppointment apt = MedicalAppointment.Create();
apt.StartTime = startTime;
apt.EndTime = endTime;
apt.DoctorId = doctorId;
apt.Notes = notes;
apt.Location = location;
apt.CategoryId = categoryId;
apt.PatientName = patientName;
apt.InsuranceNumber = insuranceNumber;
apt.FirstVisit = firstVisit;
return apt;
}
protected MedicalAppointment() { }
public virtual int Id { get; set; }
public virtual bool AllDay { get; set; }
public virtual DateTime StartTime { get; set; }
public virtual DateTime EndTime { get; set; }
public virtual string PatientName { get; set; }
public virtual string Notes { get; set; }
public virtual string Subject { get; set; }
public virtual int StatusId { get; set; }
public virtual int CategoryId { get; set; }
public virtual int Type { get; set; }
public virtual string Location { get; set; }
public virtual string RecurrenceInfo { get; set; }
public virtual string ReminderInfo { get; set; }
public virtual int? DoctorId { get; set; }
public virtual string InsuranceNumber { get; set; }
public virtual bool FirstVisit { get; set; }
}
Public Class MedicalAppointment
Public Shared Function Create() As MedicalAppointment
Return ViewModelSource.Create(Function() New MedicalAppointment())
End Function
Friend Shared Function Create(ByVal startTime As Date, ByVal endTime As Date, ByVal doctorId As Integer, ByVal notes As String, ByVal location As String, ByVal categoryId As Integer, ByVal patientName As String, ByVal insuranceNumber As String, ByVal firstVisit As Boolean) As MedicalAppointment
Dim apt As MedicalAppointment = MedicalAppointment.Create()
apt.StartTime = startTime
apt.EndTime = endTime
apt.DoctorId = doctorId
apt.Notes = notes
apt.Location = location
apt.CategoryId = categoryId
apt.PatientName = patientName
apt.InsuranceNumber = insuranceNumber
apt.FirstVisit = firstVisit
Return apt
End Function
Protected Sub New()
End Sub
Public Overridable Property Id() As Integer
Public Overridable Property AllDay() As Boolean
Public Overridable Property StartTime() As Date
Public Overridable Property EndTime() As Date
Public Overridable Property PatientName() As String
Public Overridable Property Notes() As String
Public Overridable Property Subject() As String
Public Overridable Property StatusId() As Integer
Public Overridable Property CategoryId() As Integer
Public Overridable Property Type() As Integer
Public Overridable Property Location() As String
Public Overridable Property RecurrenceInfo() As String
Public Overridable Property ReminderInfo() As String
Public Overridable Property DoctorId() As Integer?
Public Overridable Property InsuranceNumber() As String
Public Overridable Property FirstVisit() As Boolean
End Class
Imports System
Imports System.Collections.ObjectModel
Namespace SimpleSchedulingExample
Public Class MainViewModel
Public Overridable Property Doctors() As ObservableCollection(Of Doctor)
Public Overridable Property Appointments() As ObservableCollection(Of MedicalAppointment)
Protected Sub New()
CreateDoctors()
CreateMedicalAppointments()
End Sub
Private Sub CreateDoctors()
Doctors = New ObservableCollection(Of Doctor)()
Doctors.Add(Doctor.Create(Id:= 1, Name:= "Stomatologist"))
Doctors.Add(Doctor.Create(Id:= 2, Name:= "Ophthalmologist"))
Doctors.Add(Doctor.Create(Id:= 3, Name:= "Surgeon"))
End Sub
Private Sub CreateMedicalAppointments()
Appointments = New ObservableCollection(Of MedicalAppointment)()
Appointments.Add(MedicalAppointment.Create(startTime:= Date.Now.Date.AddHours(10), endTime:= Date.Now.Date.AddHours(11), doctorId:= 1, notes:= "", location:= "101", categoryId:=1, patientName:= "Dave Muriel", insuranceNumber:= "396-36-XXXX", firstVisit:= True))
End Sub
End Class
End Namespace
The following code snippets (auto-collected from DevExpress Examples) contain references to the AppointmentsSource property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
See Also