0

我的 XAF 应用程序中有一个业务对象,它继承自标准 Scheduler'Event' 类。在列表视图中,我得到默认的调度程序列表视图,其中的框显示描述性文本。我想在这些框中显示其他文本。我环顾四周,发现“ScheduleControl.InitAppointmentDisplayText”事件,但无法弄清楚如何在我的班级中实现它。

4

1 回答 1

0

您可以在 Module.Win 项目的视图控制器中实现以下代码。

namespace Project.Module.Win.Controllers{

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Scheduler.Win;
using DevExpress.XtraScheduler;

public partial class SchedulerViewController : ObjectViewController<ListView, Project.Module.BusinessObjects.Event>
{
    public SchedulerViewController()
    {
        this.InitializeComponent();
        this.RegisterActions(this.components);
    }

    protected override void OnViewControlsCreated()
    {
        base.OnViewControlsCreated();

        SchedulerListEditor listEditor = View.Editor as SchedulerListEditor;

        if (listEditor != null)
        {
            SchedulerControl scheduler = listEditor.SchedulerControl;

            if (scheduler != null)
            {
                scheduler.InitAppointmentDisplayText += new AppointmentDisplayTextEventHandler(this.SchedulerControl_InitAppointmentDisplayText);
            }
        }
    }

    private void SchedulerControl_InitAppointmentDisplayText(object sender, AppointmentDisplayTextEventArgs e)
    {       
        MyEventObject myEventObject = this.ObjectSpace.GetObjectByKey<MyEventObject>(e.Appointment.Id);

        if (myEventObject != null)
        {
            e.Text = string.Concat("Text Goes Here - ", myEventObject.FieldValue);
        }
    }
}
于 2015-03-18T10:42:24.020 回答