下面代码实现一个自定义日程标题
public class CustomHeaderCaptionService : HeaderCaptionServiceWrapper { public CustomHeaderCaptionService(IHeaderCaptionService service) : base(service) { } public override string GetDayColumnHeaderCaption(DayHeader header) { DateTime date = header.Interval.Start.Date; return string.Format("{0:M}({1})", date, date.DayOfWeek.ToString().GetRes()); } }
实现自定义日程标题的服务,还需要将服务添加到XtraScheduler服务
IHeaderCaptionService headerCaptionService = (IHeaderCaptionService)scMain.GetService(typeof(IHeaderCaptionService)); if (headerCaptionService != null) { CustomHeaderCaptionService customHeaderCaptionService = new CustomHeaderCaptionService(headerCaptionService); scMain.RemoveService(typeof(IHeaderCaptionService)); scMain.AddService(typeof(IHeaderCaptionService), customHeaderCaptionService); }