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.
Thanks a ton for your support. It is really great.
I am able to resolve my problem for showing existing and new appointments. The problem I faced is, even though I assigned OwningResourceId and OwningCalendarId, it is still expecting OwningrResource and OwningCalendar objects. After creating those, I was able to add new appointment and show existing ones.
But I am facing below problems now:
1. Reminder popup does not show for upcoming appointments. It only shows for expired/past appointments. Please can you shed some light into it?
2. If I keep the enter AppointmentDialogCore into a tabitem and add another 2 tabitems, the other tabitems button click events are causing a crash. I am not even able to load the appointment. Any idea on this?
Thanks again.
I am glad you were able to resolve the issue you were seeing with showing existing and new appointments.
Regarding the reminder popup, there may be a few things that you will want to check here. First, are you setting the XamScheduleDataManager's CurrentUserId property to the OwningResourceId of your Appointments? Also, are you setting the ReminderInterval property on your Appointments? The ReminderInterval determines how far before the appointment's occurrence time to show the reminder dialog. If it is not set, you will not see the appointment reminder until the appointment is about to happen. Here is a link to our online documentation for more information about XamSchedule reminders: http://help.infragistics.com/doc/WPF/2015.1/CLR4.0/?page=xamSchedule_Using_Activities_Reminders.html.
Regarding the AppointmentDialogCore inside of a tab item causing an exception, I cannot seem to reproduce this behavior you are seeing. I am a little unsure as to how you are placing the AppointmentDialogCore into a tab item, or whether the XamSchedule itself is in the TabControl that houses the tab items as well. Could you please provide some more detail on the functionality you are implementing here?
I have attached the sample project that I used to test this. If the TabControl mentioned in your step 2 does not depict what you are trying to achieve, would it be possible for you to modify it and send it back so that I can see the behavior you are seeing?