学习022-09 How to: Customize Status and Label Properties(如何:自定义状态和标签属性)

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()
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

汤姆•猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值