We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Add programmatically events to calendar

Thread ID:

Created:

Updated:

Platform:

Replies:

117522 Nov 3,2014 08:00 AM Nov 13,2014 03:06 PM WinRT 8
loading
Tags: SfCalendar
Andrea Grillo
Asked On November 3, 2014 08:00 AM

Hi,
I would ask you how can I add/remove programmatically events to calendar.

In your samples, you add events in the constructor of AppointmentSource class, so I can load events ONLY when I load page.

How can I add/remove dinamically events with custom methods in AppointmentSource class?

Thanks you for the support,
Bye

Bharadhi K [Syncfusion]
Replied On November 5, 2014 01:46 AM

Hi Andrea,

Thank you for using Syncfusion Products.

We have prepared a sample in which we have tried to meet your requirements. In sample, we have added a button and in its click event we have added a new appointment for the selected date in the Calendar using “SelectedDate”  Property. Similarly we have added a button for removing the appointment for the Selected Date.

Please find the sample attached.

Regards,
Bharadhi K


Attachment: SfCalendar_117522_42421573.zip

Andrea Grillo
Replied On November 9, 2014 04:18 PM

Hi,
thank you for reply.

Now, I can add and remove item, but when I add something, the TransitionContentControl (list) doesn't show me any Appointments (only calendars shows title in the cell template).
I think that DataContext (or something like that) of TransitionContentControl must be refreshed, but I don't know how.

Can you help me, please?

Thank you again,
Bye

Bharadhi K [Syncfusion]
Replied On November 10, 2014 07:16 AM

Hi Andrea,

We have modified the sample in which we have tried to meet your requirements. In the sample, we have refreshed the SelectedDate of the Calendar while adding or removing an Appointment.
Please find the attached sample.

Regards,
Bharadhi K

Attachment: SfCalendar_117522_cb45b877.zip

Andrea Grillo
Replied On November 10, 2014 09:53 AM

Hi,
thank you for fastly response, but the problem persist.

As you can see in the zip file, when I tap on new user event ("Favorite movie with family" in my screenshots) the list at the bottom of calendar doesn't show it

How can I solve that?

Regards


screenshot1: "AppointmentSource" class
screenshot2: appointment loaded in constructor
screenshot3: no detailed information about appointment added in "AddAppointment" method


Attachment: calendar_43cbf8af.zip

Bharadhi K [Syncfusion]
Replied On November 11, 2014 07:53 AM

Hi Andrea,

We are unable to reproduce the issue in the sample which we had updated in the previous update. Could you please check if you have set the SelectedDate of the SfCalendar after you have added the Appointment as we had shown in the provided sample.

Please find the screenshots attached.
Screenshot1 - Appointment loaded in Constructor
ScreenShot2 - Appointment added by clicking the "Add Appointment on Selected Date" button.

Regards,
Bharadhi K

Attachment: SfCalendar_8180e2f9.zip

Andrea Grillo
Replied On November 11, 2014 05:05 PM

My code seems ok. To be sure, I attached my code files (XAML and code behind).

Sorry for long discussion, I have to thank you!

Attachment: Code_a2bfef79.zip

Bharadhi K [Syncfusion]
Replied On November 13, 2014 04:52 AM

Hi Andrea,

The problem arose because the Resources have been defined for the Page but while refreshing the template, the code is set to get the Resources from App file. To resolve this, please remove the resources defined in MainPage.xaml and add it to the ResourceDictionary of App.xaml (This is done in the sample provided in the previous update).

We have also modified your code. Please find the modified code in the following link.

Regards,
Bharadhi K

Attachment: Code_b36679d0.zip

Andrea Grillo
Replied On November 13, 2014 03:06 PM

It works fine!

Thank you very much for support me,
bye! :)

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;