不同颜色的 Telerik 调度程序约会
我正在读取数据表中的约会。这是我的代码:
List<MyClass> myObjects = (from e in myEntities.Mytable where
e.DateFrom >= schedulerInfo.ViewStart &&
e.DateTo <= schedulerInfo.ViewEnd
select e).ToList();
List<Appointment> appointments = new List<Appointment>(myObjects.Count);
foreach (MyClass e in myObjects) {
Appointment a = new Appointment();
a.ID = e.ID;
a.Subject = e.Description;
a.Start = e.DateFrom;
a.End = e.DateTo;
a.BackColor = System.Drawing.Color.Yellow;
appointments.Add(a);
当我运行它时,它不是黄色的!
I'm reading the appointments form a datatable. Here is my code:
List<MyClass> myObjects = (from e in myEntities.Mytable where
e.DateFrom >= schedulerInfo.ViewStart &&
e.DateTo <= schedulerInfo.ViewEnd
select e).ToList();
List<Appointment> appointments = new List<Appointment>(myObjects.Count);
foreach (MyClass e in myObjects) {
Appointment a = new Appointment();
a.ID = e.ID;
a.Subject = e.Description;
a.Start = e.DateFrom;
a.End = e.DateTo;
a.BackColor = System.Drawing.Color.Yellow;
appointments.Add(a);
and when I run it, it isn't yellow!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了更改 RadScheduler 中约会的颜色,您必须订阅 OnAppointmentDataBound 事件。正如这篇文档文章,您所要做的就是从
e.Appointment
获取当前约会对象并定义 BackColor(和其他可用属性),您应该已全部准备就绪!In order to change the color of an appointment in the RadScheduler you will have to subscribe to the OnAppointmentDataBound event. As can be seen in this documentation article, all you have to do is grab the current appointment objects from
e.Appointment
and define the BackColor (and other available properties) and you should be all set!