@using System.Globalization
<SfSchedule>
<ScheduleEventSettings DataSource="@DataSource"></ScheduleEventSettings>
<ScheduleTimeScale Interval="60" SlotCount="4">
<MajorSlotTemplate>
<div>@(majorSlotTemplate((context as TemplateContext).Date))</div>
<div class="@($"{(Totalevents <= 3 ? "total-event1" : "total-event2")}")"><span class="span-class" style="margin-left: 15px;">@Totalevents</span></div>
</MajorSlotTemplate>
</ScheduleTimeScale>
</SfSchedule>
@code {
public int Totalevents;
public List<AppointmentData> filteredData;
public string majorSlotTemplate(DateTime date)
{
filteredData =
DataSource.Where(a => a.StartTime == date).ToList();
Totalevents =
filteredData.Count;
return date.ToString("hh", CultureInfo.InvariantCulture);
}
}
<style>
.total-event1 {
background-color: #90ee90;
border: 1px solid #ffffff;
}
.total-event2 {
background-color: #6495ed;
border: 1px solid #ffffff;
}
</style>
|