How to: Customize Status and Label Properties(如何:自定义状态和标签属性)
This topic describes how to define custom statuses and labels for your Scheduler events in XAF ASP.NET Core Blazor, Windows Forms, or ASP.NET Web Forms applications.
本主题介绍如何在XAF ASP.NET Core Blazor、Windows Forms或ASP.NET Web Forms应用程序中为调度器事件定义自定义状态和标签。
Note
For this article, you can use the MainDemo application installed as part of the XAF package. The default location of the application is %PUBLIC%\Documents\DevExpress Demos 24.1\Components\XAF.
在本文中,您可以使用作为XAF包一部分安装的MainDemo应用程序。该应用程序的默认位置是%PUBLIC%\Documents\DevExpress Demos 24.1\Components\XAF。
The instructions below explain how to define the following custom items:
以下说明介绍如何定义以下自定义项:
-
“Vacation” and “Personal” labels
“Vacation”(假期)和“Personal”(个人)标签 -
“Free” and “Out of Office” statuses
“Free”(空闲)和“Out of Office”(外出)状态
ASP.NET Core Blazor
XAF stores source data for labels and status items in a DxSchedulerDataStorage object. Use the OnSchedulerDataStorageCreated event to customize this object’s settings. Specified values will be available for Label and Status properties of the built-in Event object (or your custom IEvent implementation).
XAF将标签和状态项的源数据存储在DxSchedulerDataStorage对象中。使用OnSchedulerDataStorageCreated事件自定义该对象的设置。指定的值将可用于内置Event对象(或您的自定义IEvent实现)的Label和Status属性。
1.In the Solution Explorer, navigate to the MainDemo.Blazor.Server\Startup.cs file and make the following changes to the AddScheduler(IModuleBuilder, Action) method:
在解决方案资源管理器中,导航到MainDemo.Blazor.Server\Startup.cs文件,并对AddScheduler(IModuleBuilder, Action)方法进行如下修改:
C#
using System.Drawing;
using DevExpress.Blazor;
using DevExpress.ExpressApp.Scheduler.Blazor;
namespace MainDemo.Blazor {
public class Startup {
public void ConfigureServices(IServiceCollection services) {
// ...
services.AddXaf(Configuration, builder => {
builder.Modules.AddScheduler(options => {
options.Events.OnSchedulerDataStorageCreated = context => {
context.SchedulerDataStorage.AppointmentLabelsSource = new DxSchedulerAppointmentLabelItem[] {
new DxSchedulerAppointmentLabelItem() {
Id = 0, Caption = "Vacation", Color = Color.DeepPink },
new DxSchedulerAppointmentLabelItem() {
Id = 1, Caption = "Personal", Color = Color.LightSeaGreen }
};
context.SchedulerDataStorage.AppointmentStatusSource = new DxSchedulerAppointmentStatusItem[] {
new DxSchedulerAppointmentStatusItem()

最低0.47元/天 解锁文章
3271

被折叠的 条评论
为什么被折叠?



