DxSchedulerTimelineView.TimeCellTemplate Property
Specifies the template used to display time cells in the Scheduler.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public RenderFragment<SchedulerTimeCellInfo> TimeCellTemplate { get; set; }
Property Value
Type | Description |
---|---|
RenderFragment<SchedulerTimeCellInfo> | The time cell template. |
Remarks
The TimeCellTemplate
allows you to customize the content and appearance of time cells in the Scheduler.
This template accepts a SchedulerTimeCellInfo object as the context
parameter. You can use the parameter’s Interval property to get the interval to which the time cell belongs. The parameter’s Resource property specifies the resource associated with the time cell or contains an empty resource item if no resource is assigned.
The following example displays the number of appointments in time cells that correspond to work days:
@using Data
<DxScheduler StartDate="@DateTime.Today"
DataStorage="@DataStorage"
ActiveViewType="SchedulerViewType.Timeline">
<Views>
<DxSchedulerTimelineView Duration="TimeSpan.FromDays(7)">
<Scales>
<DxSchedulerTimeScale Unit="SchedulerTimeScaleUnit.Day"></DxSchedulerTimeScale>
</Scales>
<TimeCellTemplate>
@{
if (!IsWeekend(context.Interval.Start)) {
<div style="height: 100%; display: flex; align-items: flex-end; background-color:lavender">
<b>Count: @DataStorage.GetAppointments(context.Interval).ToList().Count</b>
</div>
}
}
</TimeCellTemplate>
</DxSchedulerTimelineView>
</Views>
</DxScheduler>
@code {
DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
AppointmentsSource = RecurringAppointmentCollection.GetAppointments(),
AppointmentMappings = new DxSchedulerAppointmentMappings() {
Type = "AppointmentType",
Start = "StartDate",
End = "EndDate",
Subject = "Caption",
AllDay = "AllDay",
Location = "Location",
Description = "Description",
LabelId = "Label",
StatusId = "Status",
RecurrenceInfo = "Recurrence"
}
};
bool IsWeekend(DateTime date) {
return date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday;
}
}