Telerik UI for Windows Phone by Progress

Getting started with Telerik Cloud Synchronization

To use the Telerik Cloud Synchronization mechanism with the Telerik Cloud Services, codenamed Everlive, you have two options:

  • Create a new Windows Phone application by using the Telerik Cloud App for Windows Phone Visual Studio project template
  • Manually integrate the mechanism into an existing Windows Phone application project

The following paragraphs assume that you have Telerik UI for Windows Phone installed on your machine and have created all needed Content Types in your Everlive application.


The Telerik Cloud Synchronization mechanism is designed to be easily integrated with different Cloud Service providers. We currently ship support for the following providers:

Creating a new Telerik Cloud Synchronization Windows Phone application

This topic will use the Telerik Cloud Synchronization Windows Phone app Project Wizard that comes with the Telerik UI for Windows Phone package. This wizard creates a sample Windows Phone application for managing a TO-DO list of items. It stores the TO-DO items both locally and in the Telerik Everlive Cloud Services, allows offline data access and uses the Telerik Cloud Synchronization Mechanism to synchronize these items among multiple devices.

To create a Telerik Cloud Synchronization enabled application choose the Telerik Cloud Synchronization Windows Phone Application template in the New Project dialog of Visual Studio 2012:

Synchronization-Cloud Wizard 1

The Telerik Cloud Synchronization Windows Phone App template allows you to create a Windows Phone app project which is prepared to use the Telerik Everlive Cloud Services. After choosing this project template you will be presented with Wizard which will ask you for your Telerik credentials:

Synchronization-Cloud Wizard 2

With these credentials you will log into the Telerik Everlive Cloud Services.

After logging in you will have to give a name to the Telerik Cloud Project and a description if you wish. The name of the project must not contain any whitespaces.

Synchronization-Cloud Wizard 3

Click on 'Finish' and Visual Studio will create a new, Telerik Everlive Cloud Services enabled Windows Phone application project.

The wizard will create a single Content Type within your project called Tasks. It will be used to demonstrate the Synchronization mechanism. Here is how this will look like when you log onto the Telerik Everlive Cloud Services website and open the newly created project:

Synchronization-Cloud Wizard 4

Diving into the Sample Project's Code

There are several important places in the new application's code which are related to setting up the Telerik Cloud Synchronization mechanism in the newly created Windows Phone application. The first one is the App.cs file where the so called CloudProvider is initialized:

private void InitializeProvider()
    EverliveProviderSettings settings = new EverliveProviderSettings();
    settings.ApiKey = "$EverliveApplicationKey$";

This will ensure that the Telerik Cloud Synchronization Mechanism will have access to the corresponding Cloud Service which it will synchronize with. In this particular case we will be using the Telerik Everlive Cloud Services.

The further initialization of the synchronization infrastructure is done in the Models\MainViewModel.cs class as follows:

internal void InitContext()
    SynchronizationContextPool.RegisterContextForType<Task>(new EverliveSyncServiceProvider<Task>(CloudProvider.Current.CurrentUser.Id + "_local.db"));
    this.tasksContext = SynchronizationContextPool.GetContextForType<Task>();
    this.tasksContext.SynchronizationFilter = task => task.CreatedBy == CloudProvider.Current.CurrentUser.Id;

This code uses the Task type which describes the to-do items that will be synchronized. The first line of code registers a SynchronizationContext instance for the Task type. The EverliveServiceProvider class is the main object which provides access to the Telerik Everlive Cloud Services and the local storage. After that a reference to the dedicated SynchronizationContext instance is saved in the MainViewModel for application access. We then set the SynchronizationFilter property on the SynchronizationContext which is used to filter out certain objects when making the Cloud calls. For instance, we may want to synchronize objects only created by the current application user - which is also the case here. This filter will exclude all tasks created by another users of the same application.

The SynchronizationContext exposes the View property which gives you access to all locally stored objects available since the last synchronization. If no synchronization was performed, the first SynchronizeAsync call will load the local items. In the MainViewModel class the View property is used to expose access to the stored to-do items throughout the whole application.

On the main page of the application the OnNavigatedTo method is overriden as follows:

protected override void OnNavigatedTo(NavigationEventArgs e)



The SynchronizeAsync call initiates a synchronization procedure which makes sure all objects currently stored in the Cloud, and all objects currently stored locally are in sync.