Customizing Dialog Windows

To customize the RadScheduleView dialogs, e.g. the window content, please read the Custom Dialogs article

The dialogs in RadScheduleView are displayed in RadWindow instances by default. You can either customize the RadWindow or entirely replace it with any other ContentControl.

RadScheduleView uses the IScheduleViewDialogHostFactory and IScheduleViewDialogHost interfaces to abstract the dialog hosts and their generation. The default implementation of the IScheduleViewDialogHostFactory interface that creates RadWindow instances is named ScheduleViewDialogHostFactory.

Custom RadWindow

Create a new class, deriving from ScheduleViewDialogHostFactory and override the CreateNew method:

Example 1: Custom ScheduleViewDialogHostFactory with customized RadWindow

public class CustomScheduleViewDialogHostFactory : ScheduleViewDialogHostFactory
{
    protected override IScheduleViewDialogHost CreateNew(ScheduleViewBase scheduleView, DialogType dialogType)
    {
        var host = base.CreateNew(scheduleView, dialogType);
        var window = host as RadWindow;
        // Set properties on RadWindow here.
        return host;
    }
}

Configure RadScheduleView to use the new class:

Example 2: Set SchedulerDialogHostFactory

<telerik:RadScheduleView>
    <telerik:RadScheduleView.SchedulerDialogHostFactory>
        <local:CustomScheduleViewDialogHostFactory />
    </telerik:RadScheduleView.SchedulerDialogHostFactory>
</telerik:RadScheduleView>

Replace RadWindow with Custom Control

Create a new class, deriving from ChildWindow and implement the IScheduleViewDialogHost interface:

Example 3: Custom IScheduleViewDialogHost

public class WindowDialogHost : ChildWindow, IScheduleViewDialogHost
{
    private bool opened;

    protected override void OnOpened()
    {
        base.OnOpened();
        this.opened = true;
    }
    protected override void OnClosed(System.EventArgs e)
    {
        base.OnClosed(e);
        if (this.Closed != null && this.opened)
        {
            this.opened = false;
            this.Closed(this, new WindowClosedEventArgs());
        }
    }

    public new event EventHandler<WindowClosedEventArgs> Closed;

    public ScheduleViewBase ScheduleView { get; set; }

    void IScheduleViewDialogHost.Close()
    {
        if (this.opened)
        {
            this.Close();
        }
    }

    public void Show(bool isModal)
    {
        this.Show();
    }
}

Create a new class and implement the IScheduleViewDialogHostFactory:

Example 4: Custom ScheduleViewDialogHostFactory with Custom IScheduleViewDialogHost

public class CustomScheduleViewDialogHostFactory : IScheduleViewDialogHostFactory
{
    public virtual IScheduleViewDialogHost CreateNew(ScheduleViewBase scheduleView, DialogType dialogType)
    {
        var window = new WindowDialogHost
        {
            Content = new SchedulerDialog(),
            ScheduleView = scheduleView
            // Set additional properties here
        };
        return window;
     }    
}

Configure RadScheduleView to use the new factory:

Example 5: Set SchedulerDialogHostFactory

<telerik:RadScheduleView . . .>
    <telerik:RadScheduleView.SchedulerDialogHostFactory>
        <local:CustomScheduleViewDialogHostFactory />
    </telerik:RadScheduleView.SchedulerDialogHostFactory>
</telerik:RadScheduleView>

Figure 1: Custom appointment dialog

radscheduleview customizingdialogs

In this article
Not finding the help you need? Improve this article