[PR #2392] [MERGED] As per Issue 2388 - Add another condition for overlapping appointments #3233

Open
opened 2026-01-29 18:22:32 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/radzenhq/radzen-blazor/pull/2392
Author: @paulo-rico
Created: 12/16/2025
Status: Merged
Merged: 12/16/2025
Merged by: @akorchev

Base: masterHead: master


📝 Commits (1)

  • 44c1619 Add another condition for overlapping appointments

📊 Changes

1 file changed (+6 additions, -0 deletions)

View changed files

📝 Radzen.Blazor/Rendering/MonthView.razor (+6 -0)

📄 Description

As per issue 2388

This PR adds another condition for overlapping appointments that resolves the above issue.

This is the code from the example the Issuer created in GitHub that can now be pasted into a Radzen example -

@using System.Globalization

<RadzenScheduler @ref="_scheduler"
                 style="height: 768px;"
                 SlotRender="@OnSlotRender"
                 TItem="MyAppointment"
                 Data="_appointments"
                 AppointmentRender="args => AppointmentRender(args)"
                 LoadData="args => LoadDataAsync(args)"
                 StartProperty="@nameof(Appointment.Start)"
                 EndProperty="@nameof(Appointment.End)"
                 TextProperty="@nameof(Appointment.Text)">
    <RadzenMonthView Text=""/>
</RadzenScheduler>

@code
{
    private class MyAppointment
    {
        public DateTime Start { get; set; }
        public DateTime End { get; set; }
        public string Text { get; set; }
        public string Color { get; init; }
    }

    private RadzenScheduler<MyAppointment>? _scheduler;
    private readonly CultureInfo _culture = new("da-DK");
    private List<MyAppointment> _appointments = new List<MyAppointment>();

    void OnSlotRender(SchedulerSlotRenderEventArgs args)
    {
        // Highlight today in month view
        if (args.Start.Date == DateTime.Today)
        {
            args.Attributes["style"] = "background: var(--rz-scheduler-highlight-background-color, rgba(255,220,40,.2));";
        }
    }

    private void AppointmentRender(SchedulerAppointmentRenderEventArgs<MyAppointment> args)
    {
        args.Attributes["style"] = $"background: {args.Data.Color}";
    }

    private async Task LoadDataAsync(SchedulerLoadDataEventArgs args)
    {
        if (_scheduler != null)
        {
            _scheduler.DefaultCulture = _culture;
        }

        _appointments.Add(new MyAppointment
            {
                Start = new DateTime(2025,12,8),
                End = new DateTime(2025,12,8),
                Color = "Orange",
                Text = "8th of Dec",
            });

        _appointments.Add(new MyAppointment
            {
                Start = new DateTime(2025,12,9),
                End = new DateTime(2025,12,9),
                Color = "Purple",
                Text = "9th of Dec",
            });

        _appointments.Add(new MyAppointment
            {
                Start = new DateTime(2025,11,18),
                End = new DateTime(2025,12,9, 23, 59, 00),
                Color = "Red",
                Text = "18th of Nov to 9th of Dec",
            }); 
    }
}


Regards

Paul


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/radzenhq/radzen-blazor/pull/2392 **Author:** [@paulo-rico](https://github.com/paulo-rico) **Created:** 12/16/2025 **Status:** ✅ Merged **Merged:** 12/16/2025 **Merged by:** [@akorchev](https://github.com/akorchev) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`44c1619`](https://github.com/radzenhq/radzen-blazor/commit/44c1619a6b84848748e9b63c36636c0c10056ec3) Add another condition for overlapping appointments ### 📊 Changes **1 file changed** (+6 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `Radzen.Blazor/Rendering/MonthView.razor` (+6 -0) </details> ### 📄 Description As per [issue 2388](https://github.com/radzenhq/radzen-blazor/issues/2388) This PR adds another condition for overlapping appointments that resolves the above issue. This is the code from the example the Issuer created in GitHub that can now be pasted into a Radzen example - ``` @using System.Globalization <RadzenScheduler @ref="_scheduler" style="height: 768px;" SlotRender="@OnSlotRender" TItem="MyAppointment" Data="_appointments" AppointmentRender="args => AppointmentRender(args)" LoadData="args => LoadDataAsync(args)" StartProperty="@nameof(Appointment.Start)" EndProperty="@nameof(Appointment.End)" TextProperty="@nameof(Appointment.Text)"> <RadzenMonthView Text=""/> </RadzenScheduler> @code { private class MyAppointment { public DateTime Start { get; set; } public DateTime End { get; set; } public string Text { get; set; } public string Color { get; init; } } private RadzenScheduler<MyAppointment>? _scheduler; private readonly CultureInfo _culture = new("da-DK"); private List<MyAppointment> _appointments = new List<MyAppointment>(); void OnSlotRender(SchedulerSlotRenderEventArgs args) { // Highlight today in month view if (args.Start.Date == DateTime.Today) { args.Attributes["style"] = "background: var(--rz-scheduler-highlight-background-color, rgba(255,220,40,.2));"; } } private void AppointmentRender(SchedulerAppointmentRenderEventArgs<MyAppointment> args) { args.Attributes["style"] = $"background: {args.Data.Color}"; } private async Task LoadDataAsync(SchedulerLoadDataEventArgs args) { if (_scheduler != null) { _scheduler.DefaultCulture = _culture; } _appointments.Add(new MyAppointment { Start = new DateTime(2025,12,8), End = new DateTime(2025,12,8), Color = "Orange", Text = "8th of Dec", }); _appointments.Add(new MyAppointment { Start = new DateTime(2025,12,9), End = new DateTime(2025,12,9), Color = "Purple", Text = "9th of Dec", }); _appointments.Add(new MyAppointment { Start = new DateTime(2025,11,18), End = new DateTime(2025,12,9, 23, 59, 00), Color = "Red", Text = "18th of Nov to 9th of Dec", }); } } ``` Regards Paul --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 18:22:32 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#3233