Cancel AppointmentDialogViewModel.Confirmed Event

6 posts, 1 answers
  1. Heiko
    Heiko avatar
    124 posts
    Member since:
    Oct 2012

    Posted 08 Oct 2012 Link to this post

    I heavily make use of AppointmentDialogViewModel and its properties. When showing the Appointment Dialog I add my own ViewModel as "AdditionalData" and add a method to the Confirmed EventHandler of ADVM.

    Question is: is there a way to cancel closing of AppointmentDialog when in Confirmed EventHandler method?

    TIA
    Neils
  2. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 11 Oct 2012 Link to this post

    Hello Neils,

    I would suggest you a different approach. Instead of hooking to the Confirmed EventHandler, you could hook to the DialogClosing event of the RadScheduleView. There in the event's arguments, the DialogResult shows whether the ok or cancel button has been clicked. According to it you could cancel the closing of the dialog.

    Hope this helps.

    All the best,
    Konstantina
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Heiko
    Heiko avatar
    124 posts
    Member since:
    Oct 2012

    Posted 11 Oct 2012 Link to this post

    Sorry, but I can't find the DialogClosing event in RadScheduleView at all. I also checked the source code (ScheduleView.Events.cs) and there is no DialogClosing event. I use build 2012.2.607.1050.

    Regards
    Neils
  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 15 Oct 2012 Link to this post

    Hi Neils,

    The event is added later. Could you please try with one of the latest versions - either the Q2 SP2 or the latest internal build from last week. They include the new event.

    Greetings,
    Konstantina
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Heiko
    Heiko avatar
    124 posts
    Member since:
    Oct 2012

    Posted 26 Oct 2012 Link to this post

    Hello Konstantina,

    thank you very much for your help. The DialogClosing event is indeed the place where to do validiation etc.

    Maybe a little hint for others who are reading this. Since I make heavy use of the AppointmentDialogViewModel when working with the Appointment-Dialog I want to have access to it inside the DialogClosing event. The CancelRoutedEventArgs does not expose the SchedulerDialogViewModel directly. But if you cast it to DialogEventArgs everything is fine. Here is my code:

    // e is of type CancelRoutedEventArgs, second argument of DialogClosing event
    var vm = ((DialogEventArgs)e).DialogViewModel as AppointmentDialogViewModel;
    var myAppointment = vm.Occurrence.Appointment;

    From there on you can do everything you want with the ViewModel and its properties.

    Regards
    Neils

  7. Gaetano Gliatta
    Gaetano Gliatta avatar
    7 posts
    Member since:
    Mar 2010

    Posted 10 Jul 2014 in reply to Heiko Link to this post

    Thank you Neil,
    it was very helpful for me!
Back to Top
DevCraft banner