《Blazor》的teleerik UI免费下载30天试用版

任命模板

可以通过调度程序的约会模板更改在其约会中呈现的内容。这允许您更改事件标题的默认显示,并为用户添加更多信息,如图标、按钮、开始和结束时间以及自定义字段。

有两个模板:

  • ItemTemplate-控制在一天范围内的常规约会的呈现。

  • AllDayItemTemplate-控制“全天”行中全天约会的呈现。它不适用于Month视图,因为该视图不会基于此区分约会,但是您可以在自定义模板中为此类约会呈现不同的内容。

约会模板允许您控制约会内容的呈现,但它保留了其他内置的约会功能——比如拖拽和调整手柄的大小、删除图标、指示约会是否超过一天的箭头。

您可以为整个调度器设置模板,也可以为每个调度器设置模板视图。如果在特定视图上设置了模板,那么对于整个调度器,它将优先于共享模板。

上下文模板中要显示的项。您可以将其强制转换为您使用的模型类型。

控件将类添加到它们的包装元素中,从而为整个约会设置样式ItemRender事件

在调度程序中使用约会模板和全天约会模板的示例。Month视图使用与其他视图不同的模板

@*在月视图中覆盖的约会的一些自定义示例,其中房地产很小*@   
@{var约会=上下文作为scheduleappointment;@if (!string.IsNullOrEmpty(appointment.Icon)) {}@appointment。Title //确定约会是否足够大以容纳更多文本的示例逻辑//这依赖于当前插槽大小来呈现长约会的额外内容@if ((appointment)。约会结束。开始。TotalMinutes > 60) {
从@appointment. start . toshorttimestring()到@appointment. end . toshorttimestring ()
}}
@{var appointment = context as SchedulerAppointment;@appointment。标题开始于@appointment. start . date . toshortdatestring()结束于@appointment. end . date . toshortdatestring () } < scheduleviews > < scheduledayview StartTime="@ daystart " /> < scheduleweekview StartTime="@ daystart " /> < schedulemonthview > @{var appointment = context as scheduleappointment;//月视图没有专用的全天模板,因为没有专用的呈现槽用于此类事件//该模板显示了一种方法,使它们在月视图中看起来与其他事件不同/特殊if (appointment.IsAllDay) {@appointment. //Title} else {
@appointment.Start.ToShortTimeString()到@appointment.End.ToShortTimeString()
}}
@code {public DateTime StartDate {get;设置;} = new DateTime(2019,11,29); public SchedulerView CurrView { get; set; } = SchedulerView.Week; public DateTime DayStart { get; set; } = new DateTime(2000, 1, 1, 8, 0, 0);//the time portion is important List Appointments = new List() { new SchedulerAppointment { Title = "Vet visit", Description = "The cat needs vaccinations and her teeth checked.", Start = new DateTime(2019, 11, 26, 11, 30, 0), End = new DateTime(2019, 11, 26, 12, 0, 0) }, new SchedulerAppointment { Title = "Planning meeting", Description = "Kick off the new project.", Start = new DateTime(2019, 11, 25, 9, 30, 0), End = new DateTime(2019, 11, 25, 12, 45, 0), Icon = FontIcon.ExclamationCircle }, new SchedulerAppointment { Title = "Trip to Hawaii", Description = "An unforgettable holiday!", IsAllDay = true, Start = new DateTime(2019, 11, 27), End = new DateTime(2019, 12, 07) } }; public class SchedulerAppointment { public string Title { get; set; } public string Description { get; set; } public DateTime Start { get; set; } public DateTime End { get; set; } public bool IsAllDay { get; set; } public FontIcon? Icon { get; set; } } }

上面代码片段的结果

调度程序中的约会模板

另请参阅

在本文中
Baidu
map