Hi,
Continuation to http://www.infragistics.com/community/forums/p/95708/474087.aspx#474087
I want to create a new appointment on a button click. Is it possible in this Application?
I tried instantiating AppointmentDialogCore but don't know how to bring up that UI and assign a string ID value (automatically from Infragistics).
Thanks and Regards,
Nag
Hello Nag,
Thank you for your post. It sounds like what you are trying to do is add an appointment to a XamSchedule and then open that appointment's dialog core. Please correct me if my impressions here are incorrect.
To do this, I would recommend that you retrieve the DataManager from the schedule you are using, and then retrieve the DataConnector that the data manager is using. From the connector, you can retrieve the AppointmentItemsSource and add a new appointment to that. After adding the appointment, I would recommend calling DataManager.DisplayActivityDialog(myNewAppointment, frameworkElement fe) to open that appointment's dialog window. I have attached a sample project to demonstrate this. For the framework element in the method, I used "this" to have it opened by the main window.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Hi Andrew,
Not exactly like this. But I want similar functionality like in outlook double click.
In outlook, we have a new appointment button. If you click that, it will open Appointment Dialog.
I need similar functionality using Xam Outlook Calendar control. I want to have a button on my form as you have given.
But this shall not add appointment to the dataconnector. It shall add only when I save that. Otherwise, it shall discard those changes.
Your example adds to the appointments, display and if user dont want also still exists in calendar.
I believe I have another forum thread that I've answered you on. Here is the link to it: http://www.infragistics.com/community/forums/t/96027.aspx.
In that forum thread, one of the things I had recommended was to write a Style for AppointmentDialogCore and handle its Loaded event through an EventSetter. I would recommend the same thing here, except this time, you can use the Utilities class to get a Button named "saveAndClose." Once you have that button, you can hook into its Click event and add the Appointment if it hasn't been added already. You can obtain the DataManager and DataConnector from the AppointmentDialogCore to do this. On the original button click to add the Appointment, I would recommend that you do everything the same, except remove the call that adds the Appointment to the AppointmentItemsSource of the data connector.
I have attached an updated version of the original sample I had sent to demonstrate the above.
Thanks a ton for the update.
I tried using that sample but I have to replace Appointment with AppointmentDialogCore as I am using that.
If I replace that with AppointmentDialogCore, I can't get DisplayActivityDialog() working as it takes only Appointment.
If I use only Appointment (I have assigned my class object to DataItem also), I can't get "saveAndClose" button reference in the loading event as the loading event will be returning a reference to AppointmentDialogCore. This does not inherit ActivityBase so it does not return any reference for the button.
If I try to override CreateActivityDialog with AppointmentDialogCore also no use.
Please can you suggest me how to go on this?
Regards,
The Appointment and the AppointmentDialogCore need to work hand in hand, as the AppointmentDialogCore's data context is the appointment that spawned it. I'm not sure you will be able to use the AppointmentDialogCore without a corresponding Appointment object in this case. Please note that if you create an Appointment object, you do not need to add it to the XamSchedule before popping up the dialog. It only needs to have an OwningResourceId, OwningCalendarId, and Id property set on it. Everything else can be set and by utilizing the Loaded event on the AppointmentDialogCore, you can save the Appointment at a later time, if need be.
Is there any reason you cannot use both the Appointment and AppointmentDialogCore in this case? I believe if you can't, then your best option may be to create a custom dialog window and use that instead.
Just checking in, did you have any other questions or concerns on this matter?
Thank you very much for your updates.
I am able to get the dialog open but when I try to save changes, the save btn click event is fired and I can step through that.
After that event, I am getting a crash. I shall post the results.
Thanks and Regards,Nag
I am glad you were able to get the save button click event firing, but it is unfortunate that you are getting a crash afterward. I will await your post of the results of this crash that you are seeing.