Universal Windows Platform – Tutorial Insider – Calendar App


comentsys.wordpress.com today features a Universal Windows Platform tutorial showing how to create a Calendar App which allows Appointments to be added, viewed, edited or deleted from an in-app Calendar.


There’s an Item class to store a string Id plus a DateTimeOffset and string to store when appointment is for plus the Subject and Details as a string. The Library class has a const for the name of Appointment Calendar, then there’s the AppointmentStore which is specific to the Application, there’s also a method GetDateTime to get the Date and Time from a DateTimeOffset and TimeSpan. The Dialog method has an Appointment and ResourceDictionary passed in and creates a ContentDialog with a given layout to include the Date, Time, Subject and Details of an Appointment object, it also returns the values that have been entered as an Appointment when the Save button is selected.

The GetAsync method uses the AppointmentStore to get the AppointmentCalendar for the application with FindAppointmentCalendarsAsync and creates one if it doesn’t exist with CreateAppointmentCalendarAsync, ListAppointmentsAsync gets the a list of Appointment from the AppointmentCalendar within a given period from DateTimeOffsetStart to a TimeSpan range with FindAppointmentsAsync. GetAppointmentAsync gets an Appointment from the AppointmentCalendar with the GetAppointmentAsync method. Start is used to get the initial CalendarDatePicker date used by the UI to define the start date to display appointments from to be from today’s day – with DateTime.Now. ListAsync is used to populate the list of Item which is based from a list of Appointment from the ListAppointmentsAsync method. The Add method uses Dialog to create a new Appointment and writes it to the AppointmentCalendar with SaveAppointmentAsync, Edit uses Dialog with an existing Appointment from the list in the UI to make changes and then save this with SaveAppointmentAsync and Delete will remove an existing Appointment from the AppointmentCalendar with the DeleteAppointmentAsync method.

Behind the Scenes

This was a good way of showing the integration with the Windows 10 Calendars – any Appointment added will show up in the system calendars under the name of “Calendar App” – it’s also important that this is an extended Capability which is why the option for allowing access to Appointments in the Application Manifest is so important otherwise the functionality won’t work, the original intention was to use the build-in UI elements for adding and editing appointments but this didn’t allow for full integration plus there was an issue with edited appointments not showing their updates that way but this method seems the best way of showing how you can integrate calendar functionality into any application.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s