blazor-devexpress-dot-blazor-dot-dxscheduler-c7efb11d.md
Specifies the selected appointment.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
[Parameter]
public DxSchedulerAppointmentItem SelectedAppointment { get; set; }
| Type | Description |
|---|---|
| DxSchedulerAppointmentItem |
An object that stores the selected appointment.
|
When a user selects an appointment (clicks it), the Scheduler displays a tooltip with additional information about this item.
To select an appointment from code, use the SelectedAppointment property. The following code selects an appointment with the specified identifier (1) when the Scheduler appears for the first time.
<DxScheduler DataStorage="@DataStorage" @bind-SelectedAppointment="@SelectedAppointment">
<DxSchedulerWeekView ShowWorkTimeOnly="true" />
</DxScheduler>
@code {
DxSchedulerAppointmentItem SelectedAppointment { get; set; }
DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
AppointmentsSource = AppointmentCollection.GetAppointments(),
AppointmentMappings = new DxSchedulerAppointmentMappings() {
Type = "AppointmentType",
Start = "StartDate",
End = "EndDate",
Subject = "Caption",
AllDay = "AllDay",
Location = "Location",
Description = "Description",
LabelId = "Label",
StatusId = "Status",
RecurrenceInfo = "Recurrence",
Id = "Id"
}
};
protected override void OnInitialized() {
SelectedAppointment = DataStorage.GetAppointmentItemById(1);
}
}
public class Appointment {
public Appointment() { }
public string Recurrence { get; set; }
public int AppointmentType { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public string Caption { get; set; }
public string Description { get; set; }
public string Location { get; set; }
public int Label { get; set; }
public int Status { get; set; }
public bool AllDay { get; set; }
public int Id { get; set; }
}
public static partial class AppointmentCollection {
public static List<Appointment> GetAppointments() {
DateTime date = DateTime.Today;
var dataSource = new List<Appointment>() {
new Appointment {
Caption = "Install New Router in Dev Room",
StartDate = date + (new TimeSpan(0, 10, 0, 0)),
EndDate = date + (new TimeSpan(0, 12, 0, 0)),
Label = 6,
Status = 1,
Id = 1
},
new Appointment {
Caption = "Upgrade Personal Computers",
StartDate = date + (new TimeSpan(0, 13, 0, 0)),
EndDate = date + (new TimeSpan(0, 14, 30, 0)),
Label = 1,
Status = 1,
Id = 2
},
new Appointment {
Caption = "Website Redesign Plan",
StartDate = date + (new TimeSpan(1, 9, 30, 0)),
EndDate = date + (new TimeSpan(1, 11, 30, 0)),
Label = 1,
Status = 1,
Id = 3
},
// ...
};
return dataSource;
}
}
Handle the SelectedAppointmentChanged event to track selection changes.
See Also