Telerik UI for Windows Phone by Progress

Adding a RadCloudSettingsControl instance in your Windows Phone application

The following steps will guide you through the process of setting up your application settings with RadCloudSettingsControl:

  1. Create a class that will have the settings that your application will need. This class should inherit from EverliveSettings:

    CopyC#
    [ServerTypeAttribute("Settings")]
    public class TasksSettings : EverliveSettings
    {
        private bool lockPageOrientationToPortrait;
        private TimeSpan defaultReminderPeriod;
        private bool automaticallyCreateReminders;
    
        public TasksSettings()
        {
            this.DefaultReminderPeriod = TimeSpan.FromMinutes(15);
            this.AutomaticallyCreateReminders = false;
        }
    
        public bool LockPageOrientationToPortrait 
        { 
            get
            {
                return this.lockPageOrientationToPortrait;
            }
            set
            {
                if (this.lockPageOrientationToPortrait != value)
                {
                    this.lockPageOrientationToPortrait = value;
                    this.OnPropertyChanged("LockPageOrientationToPortrait");
                }
            }
        }
    
        public TimeSpan DefaultReminderPeriod 
        {
            get
            {
                return this.defaultReminderPeriod;
            }
            set
            {
                if (this.defaultReminderPeriod != value)
                {
                    this.defaultReminderPeriod = value;
                    this.OnPropertyChanged("DefaultReminderPeriod");
                }
            } 
        }
    
        public bool AutomaticallyCreateReminders
        {
            get
            {
                return this.automaticallyCreateReminders;
            }
            set
            {
                if (this.automaticallyCreateReminders != value)
                {
                    this.automaticallyCreateReminders = value;
                    this.OnPropertyChanged("AutomaticallyCreateReminders");
                }
            }
        }
    }

  2. Create its counterpart on everlive.com:
  3. Go to the App.xaml.cs file where the CloudProvider is initialized and set the SettingsType to the type that you have just defined:

    CopyC#
    EverliveProviderSettings settings = new EverliveProviderSettings();
    settings.SettingsType = typeof(TasksSettings);

  4. Define a XAML namespace in the XAML file of your page as follows:

    CopyXAML
    xmlns:telerikCloudControls="clr-namespace:Telerik.Windows.Controls.Cloud;assembly=Telerik.Windows.Controls.Cloud"

  5. Add the RadCloudSettingsControl to the page and define the fields that should be visible:

    CopyC#
    <telerikCloud:RadCloudSettingsControl x:Name="applicationSettings" >
        <Grid>
            <telerikInput:DataField
                Header="{Binding Path=LocalizedResources.LockPageOrientationMessage, Source={StaticResource LocalizedStrings}}"
                TargetProperty="LockPageOrientationToPortrait"/>
    
            <telerikInput:DataField
                Header="{Binding Path=LocalizedResources.DefaultReminderPeriodMessage, Source={StaticResource LocalizedStrings}}"
                TargetProperty="DefaultReminderPeriod"/>
    
            <telerikInput:DataField
                Header="{Binding Path=LocalizedResources.AutomaticallyCreateRemindersMessage, Source={StaticResource LocalizedStrings}}"
                TargetProperty="AutomaticallyCreateReminders" />
        </Grid>
    </telerikCloud:RadCloudSettingsControl>

    Note
    The RadCloudSettingsControl inherits from RadCloudDataForm and exposes the already known APIs that come from RadDataForm. If you need to modify the editor fields of for the separate settings, you can use the approach of defining editor fields in XAML as described in the RadDataForm help contents.
  6. Use the CloudProvider API to read the settings as shown in the snippet below:

    CopyC#
    TasksSettings currentSettings = (CloudProvider.Current.CurrentSettings as TasksSettings);
    
    if (currentSettings.LockPageOrientationToPortrait)
    {
        //...
    }
    
    if (currentSettings.AutomaticallyCreateReminders)
    {
        //...
    }