Hello, how i can paint my row, as in the screenshot. Green is not painted correctly, but blue and gray is correctly painted.
Blue - it select row
Gray - it weekend and paint like css-class through RadzenDataGridColumn
My code:
var daysInMonth = DateTime.DaysInMonth(Schedule.Year, Schedule.Month);
for (var day = 1; day <= daysInMonth; day++)
{
var currentDay = day;
var index = day - 1;
var dateTime = new DateTime(Schedule.Year, Schedule.Month, day);
var cssClass = "";
switch (dateTime.DayOfWeek)
{
case DayOfWeek.Saturday:
case DayOfWeek.Sunday:
cssClass = "holiday-row";
break;
}
var holiday = Schedule.CalendarHolidays.FirstOrDefault(x => x.Date.Day == currentDay);
if (holiday is not null)
cssClass = "holiday-row";
<RadzenDataGridColumn TItem="MonthScheduleModel" Title=@($"{day}") Width="3rem" Filterable="false" Sortable="false" CssClass="@cssClass">
<Template Context="schedule">
@{
var day = schedule.MonthSchedule.UserVisits.ElementAt(index);
var colorInt = day.AbscenceType?.Color;
Color? color = colorInt.HasValue ? Color.FromArgb(colorInt.Value) : null;
var background = color.HasValue ? ColorExtensions.HexConverter(color.Value) : "transparent";
var style = $"background: {background}; padding: 0 5px;";
}
<RadzenText Style="@style">@schedule.MonthSchedule.UserVisits.ElementAt(index).HoursCount</RadzenText>
</Template>
<EditTemplate Context="schedule">
@{
var day = schedule.MonthSchedule.UserVisits.ElementAt(index);
}
<RadzenNumeric @bind-Value="@day.HoursCount" ShowUpDown="false"/>
</EditTemplate>
<FooterTemplate>
<span class="rz-cell-data">@Schedule?.MonthSchedules?.Select(x => x.MonthSchedule.UserVisits.ElementAt(index)).Sum(x => x.HoursCount)</span>
</FooterTemplate>
</RadzenDataGridColumn>
}
