New to Telerik UI for WPF? Download free 30-day trial

Prevent Dialogs from Opening

This article covers the following topics:

How to hide a RadScheduleView dialog

In order to prevent a specific dialog from appearing , the ShowDialog event of the RadScheduleView should be cancelled. The event args contain a property called DialogViewModel which can be used to determine which dialog is going to be opened.

For example the view model for the EditAppointmentDialog is AppointmentDialogViewModel. The following code snippet shows how it can be cancelled:

<telerik:RadScheduleView AppointmentsSource="{Binding Appointments}" ShowDialog="RadScheduleView_ShowDialog"> 
    … 
</telerik:RadScheduleView> 

private void RadScheduleView_ShowDialog(object sender, ShowDialogEventArgs e) 
{ 
    if (e.DialogViewModel is AppointmentDialogViewModel) 
        e.Cancel = true; 
} 
Private Sub RadScheduleView_ShowDialog(sender As System.Object, e As ShowDialogEventArgs) 
    If TypeOf e.DialogViewModel Is AppointmentDialogViewModel Then 
       e.Cancel = True 
    End If 
End Sub 

To learn more about RadScheduleView events, check here.

How to skip ConfirmDeleteDialog

In this case DefaultDialogResult property of the event args should be set in order to stimulate pressing OK/Cancel in the dialog. If DefaultDialogResult is set to “true”, the appointment will be directly deleted:

private void RadScheduleView_ShowDialog(object sender, ShowDialogEventArgs e) 
{ 
    if (e.DialogViewModel is ConfirmDialogViewModel) 
    { 
        e.DefaultDialogResult = true; 
        e.Cancel = true; 
    } 
} 
Private Sub RadScheduleView_ShowDialog(sender As System.Object, e As ShowDialogEventArgs) 
    If TypeOf e.DialogViewModel Is ConfirmDialogViewModel Then 
        e.DefaultDialogResult = True 
        e.Cancel = True 
    End If 
End Sub 

How to preselect a certain option in RecurrenceChoiceDialog

By default “Open/Delete the occurrence” option is selected in RecurrenceChoiceDialog. This can be changed in ShowDialog event by setting IsSeriesModeSelected property of the RecurrenceChoiceDialogViewModel:

private void RadScheduleView_ShowDialog(object sender, ShowDialogEventArgs e) 
{ 
    var dialogViewModel = e.DialogViewModel as RecurrenceChoiceDialogViewModel; 
    if (dialogViewModel != null) 
    { 
        dialogViewModel.IsSeriesModeSelected = true; 
    } 
} 
Private Sub RadScheduleView_ShowDialog(sender As System.Object, e As ShowDialogEventArgs) 
   Dim dialogViewModel = TryCast(e.DialogViewModel, RecurrenceChoiceDialogViewModel) 
   If dialogViewModel IsNot Nothing Then 
       dialogViewModel.IsSeriesModeSelected = True 
   End If 
End Sub 

Check here for more information about RadScheduleView dialogs.

In this article