DevExpress:自定义XAF计划程序列表视图显示文本

DevExpress:自定义XAF计划程序列表视图显示文本,devexpress,scheduler,xaf,Devexpress,Scheduler,Xaf,我的XAF应用程序中有一个业务对象,它继承自标准调度程序“事件”类。在列表视图中,我得到默认的调度程序列表视图,其中的框显示描述性文本。我想在这些框中显示其他文本。我环顾四周,发现了“ScheduleControl.InitAppointmentDisplayText”事件,但不知道如何在我的类中实现它。您可以在Module.Win项目中的视图控制器中实现以下代码 namespace Project.Module.Win.Controllers{ using DevExpress.Expres

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

您可以在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);
        }
    }
}
namespace Project.Module.Win.Controllers{
使用DevExpress.ExpressApp;
使用DevExpress.ExpressApp.Scheduler.Win;
使用DevExpress.XtraScheduler;
公共部分类SchedulerViewController:ObjectViewController
{
公共SchedulerViewController()
{
this.InitializeComponent();
this.RegisterActions(this.components);
}
受保护的覆盖无效OnViewControlsCreated()
{
base.OnViewControlsCreated();
SchedulerListEditor listEditor=View.Editor作为SchedulerListEditor;
if(listEditor!=null)
{
SchedulerControl调度程序=listEditor.SchedulerControl;
if(调度程序!=null)
{
scheduler.InitAppointmentDisplayText+=新的AppointmentDisplayTextEventHandler(this.SchedulerControl\u InitAppointmentDisplayText);
}
}
}
private void SchedulerControl_InitAppointmentDisplayText(对象发送方,AppointmentDisplayTextEventArgs e)
{       
MyEventObject MyEventObject=this.ObjectSpace.GetObjectByKey(e.Appointment.Id);
if(myEventObject!=null)
{
e、 Text=string.Concat(“文本在这里-”,myEventObject.FieldValue);
}
}
}

我无法访问我的类的属性。e.约会只允许访问默认的“事件”属性View.Editor.List具有列表中可用的所有对象的列表。但是View.CurrentObject始终返回Null我已为您更新了答案,我已设法使其工作,显示了我的自定义字段,我已添加了参加我的活动课。