Edit this page

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 Window and implement the IScheduleViewDialogHost interface:

Example 3: Custom IScheduleViewDialogHost

public class WindowDialogHost : Window, IScheduleViewDialogHost
{
    public new event EventHandler<WindowClosedEventArgs> Closed;
    public ScheduleViewBase ScheduleView
    {
        get;
        set;
    }
    protected override void OnClosed(System.EventArgs e)
    {
        base.OnClosed(e);
        if (this.Closed != null)
        {
            this.Closed(this, new WindowClosedEventArgs());
        }
    }
    public void Show(bool isModal)
    {
        if (this.Owner == null && this.ScheduleView != null)
        {
            this.Owner = this.ScheduleView.ParentOfType<Window>();
        }
        if (isModal)
        {
            this.ShowDialog();
        }
        else
        {
            this.Show();
        }
    }
}

Create a new class and implement the IScheduleViewDialogHostFactory:

Example 4: Custom ScheduleViewDialogHostFactory with Custom IScheduleViewDialogHost

public class CustomScheduleViewDialogHostFactory : ScheduleViewDialogHostFactory
{
    protected override IScheduleViewDialogHost CreateNew(ScheduleViewBase scheduleView, DialogType dialogType)
    {
        var window = new WindowDialogHost
        {
            Content = new SchedulerDialog(),
            ScheduleView = scheduleView, 
            Width = 580,
            Height = 350,
            Background = new SolidColorBrush(Colors.LightSkyBlue)
            // 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 wpf

Was this article helpful? Yes No

Give article feedback

Tell us how we can improve this article

Dummy