blazor-devexpress-dot-blazor-dot-dxschedulerdatastorage-04154724.md
Specifies an appointment status data source.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
public IEnumerable AppointmentStatusSource { get; set; }
| Type | Description |
|---|---|
| IEnumerable |
Appointment status data.
|
The appointment displays its status as a colored strip on the left edge that indicates the availability state. The Scheduler has a built-in collection of status values:
You can use the AppointmentStatusSource property to create a collection with your own status values:
StatusObject) that stores status options and an ID.StatusObject class instances) and define their options.AppointmentStatusSource property.MyCustomField field to the StatusObject and maps this field to the status item’s MyCustomProperty.<DxScheduler StartDate="@DateTime.Today"
DataStorage="@DataStorage">
<DxSchedulerWeekView ShowWorkTimeOnly="true"></DxSchedulerWeekView>
</DxScheduler>
@code {
DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
// Specify appointment mappings here.
// ...
AppointmentStatusSource = StatusCollection.GetStatuses(),
AppointmentStatusMappings = new DxSchedulerAppointmentStatusMappings() {
Id = "Id",
Caption = "StatusCaption",
Color = "StatusColor",
// Uncomment the line below and comment the line above to specify other style options.
//CssClass = "CssClass",
// Map the source object's custom field to the status item's custom property.
CustomFieldMappings = new List<DxSchedulerCustomFieldMapping> {
new DxSchedulerCustomFieldMapping { Name = "MyCustomProperty", Mapping = "MyCustomField" }
}
}
};
}
.status1-style {
background-color: lightblue;
border-color: blue;
}
.status2-style {
background-color: lightgreen;
border-color: green;
}
public class StatusObject {
public int Id { get; set; }
public string StatusCaption { get; set; }
public System.Drawing.Color StatusColor { get; set; }
public string CssClass { get; set; }
public string MyCustomField { get; set; } // A custom field
}
public static class StatusCollection {
public static List<StatusObject> GetStatuses() {
DateTime date = DateTime.Today;
var dataSource = new List<StatusObject>() {
new StatusObject() {
Id = 1,
StatusCaption = "Resolved",
StatusColor = System.Drawing.Color.LightBlue,
// Uncomment the line below and comment the line above to specify other style options.
//CssClass = "status1-style",
MyCustomField = "Custom text for the 'Resolved' status",
},
new StatusObject() {
Id = 2,
StatusCaption = "In process",
StatusColor = System.Drawing.Color.LightGreen,
// Uncomment the line below and comment the line above to specify other style options.
//CssClass = "status2-style",
MyCustomField = "Custom text for the 'In process' status",
}
};
return dataSource;
}
}
Note
When you use templates to customize appointment appearance, the Color and CssClass property values are not applied to appointments. To access these property values in the template, use the context.Status parameter.
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AppointmentStatusSource 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.
blazor-scheduler-custom-form/CS/DxBlazorApplication1/Components/Pages/Index.razor.cs#L73
Storage.AppointmentLabelsSource = await LblService.GetLabelsAsync();
Storage.AppointmentStatusSource = await StsService.GetStatusesAsync();
}
See Also