RadScheduleView Recurrence Dialog Style

1 Answer 68 Views
ScheduleView
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
Ohad asked on 09 May 2022, 01:55 PM | edited on 10 May 2022, 07:58 AM

I would like help on how to change the Background of this Dialog


Thanks for the helpers

1 Answer, 1 is accepted

Sort by
1
Accepted
Stenly
Telerik team
answered on 12 May 2022, 12:34 PM

Hello Ohad,

One way of achieving the desired result would be to create a class that derives from ScheduleViewDialogHostFactory and then, override its CreateNew method. After that, create a new variable and call the base CreateNew method, in order to create a new dialog host. Then, cast the newly created dialog host to a type of RadWindow. If the dialogType parameter (of the CreateNew method) equals DialogType.RecurrenceDialog, subscribe to the Loaded event of the cast RadWindow element. Through the ChildrenOfType extension method, retrieve the element with a type of SchedulerDialog. On it, set its Background property to the desired value. Finally, set the newly created custom dialog host factory to the SchedulerDialogHostFactory property of the RadScheduleView instance.

The following code snippets show this suggestion's implementation:

public class CustomScheduleViewDialogHostFactory : ScheduleViewDialogHostFactory
{
    protected override IScheduleViewDialogHost CreateNew(ScheduleViewBase scheduleView, DialogType dialogType)
    {
        var host = base.CreateNew(scheduleView, dialogType);
        var window = host as RadWindow;

        if (dialogType == DialogType.RecurrenceDialog)
        {
            window.Loaded -= Window_Loaded;
            window.Loaded += Window_Loaded;
        }

        return host;
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        var window = (RadWindow)sender;

        var schedulerDialog = window.ChildrenOfType<SchedulerDialog>().FirstOrDefault();

        if (schedulerDialog != null)
        {
            schedulerDialog.Background = Brushes.Bisque;
        }
    }
}
<telerik:RadScheduleView>
    <telerik:RadScheduleView.SchedulerDialogHostFactory>
        <local:CustomScheduleViewDialogHostFactory />
    </telerik:RadScheduleView.SchedulerDialogHostFactory>
</telerik:RadScheduleView>

The produced result is as follows:

With this said, I have attached a sample application for you to test.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
commented on 15 May 2022, 08:13 AM

It helped me a lot, thank you very much!
Tags
ScheduleView
Asked by
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
Answers by
Stenly
Telerik team
Share this question
or