ConfirmDialogViewModel doesn't know SelectedAppointment

2 posts, 0 answers
  1. Art Kedzierski
    Art Kedzierski avatar
    107 posts
    Member since:
    Nov 2009

    Posted 15 Apr 2014 Link to this post

    I'm trying to customize the Delete confirmation dialog of the RadScheduleView by passing some info about the selected appointment into ConfirmDialogViewModel.AdditionalData, but I'm hitting an order of events issue. When the user clicks the 'x' of an appointment in the ScheduleView, it fires the appropriate ShowDialog event. This seems to occur before the AppointmentDeleting event which is where I would expect to access details of the selected appointment. There is no SelectedAppointment available in the ShowDialog viewmodel at that time that I can find. 

    public void Appointment_ShowDialog(object sender, ShowDialogEventArgs e)
        var confdvm = e.DialogViewModel as ConfirmDialogViewModel;
        if (confdvm != null)
            var delAppt = ((RadScheduleView)sender).SelectedAppointment as GLMAppointment;

    How do I get details of the appointment clicked for deletion at this point in the lifecycle?It looks like the normal order of events is as follows:

    1. ShowDialog
    2. AppointmentDeleting
    3. AppointmentDeleted
    Is this correct?

  2. Konstantina
    Konstantina avatar
    2332 posts

    Posted 16 Apr 2014 Link to this post

    Hi Art,

    The SelectedAppointment might be null when the Delete button is clicked. However, you could get the appointment on which the delete button is clicked in the ShowDialog event, for example:

    private void RadScheduleView_ShowDialog(object sender, Telerik.Windows.Controls.ShowDialogEventArgs e)
               var viewModel = ((Telerik.Windows.Controls.ScheduleView.ConfirmDialogViewModel)(e.DialogViewModel));
               var app = viewModel.Appointments.FirstOrDefault();

    Hope this helps.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top