This is a migrated thread and some comments may be shown as answers.

Cancel AppointmentDialogViewModel.Confirmed Event

5 Answers 90 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Heiko
Top achievements
Rank 1
Iron
Veteran
Heiko asked on 08 Oct 2012, 03:24 PM
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

5 Answers, 1 is accepted

Sort by
0
Accepted
Konstantina
Telerik team
answered on 11 Oct 2012, 09:24 AM
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.

0
Heiko
Top achievements
Rank 1
Iron
Veteran
answered on 11 Oct 2012, 03:12 PM
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
0
Konstantina
Telerik team
answered on 15 Oct 2012, 08:31 AM
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.

0
Heiko
Top achievements
Rank 1
Iron
Veteran
answered on 26 Oct 2012, 07:48 AM
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

0
Gaetano Gliatta
Top achievements
Rank 2
answered on 10 Jul 2014, 02:47 PM
Thank you Neil,
it was very helpful for me!
Tags
ScheduleView
Asked by
Heiko
Top achievements
Rank 1
Iron
Veteran
Answers by
Konstantina
Telerik team
Heiko
Top achievements
Rank 1
Iron
Veteran
Gaetano Gliatta
Top achievements
Rank 2
Share this question
or