Getting started

1. Using the framework

1.1. Prerequisites
To use the framework, the following assemblies must be referenced in the Windows Phone Application:
  • AppBarUtils (NuGet package)
  • PrismInteractivity (NuGet package)
  • Silverlight Toolkit (NuGet package)
  • Microsoft.Expression.Interactions

1.2. Referencing libraries
References to the following WPForms libraries have to be added:
  • WPForms.Common
  • WPForms.Phone

2. Create a form

To create a form add a new xaml file to your Windows Phone application. Set the build action to Resource

Add Form Content
Use the model classes to create a form:
        <model:FormSection Name="Registration form">
                <model:TextField Label="First name:" IsRequired="True"/>
                <model:TextField Label="Last name:" IsRequired="True"/>
                <model:DateTimeField Label="Date of birth:" IsRequired="False"/>
                <model:GeoLocation Label="Address:" IsRequired="True"/>
                <model:PictureAttachment Label="Portrait:" IsRequired="True"/>
                <model:FormSection Name="Shipping information">
                        <model:TextField Label="Bill to:"/>
                        <model:GeoLocation Label="Delivery address:"/>
                        <model:DateTimeField Label="Preferred day:"/>

3. Create Bootstrapper

3.1. Create a new Bootstrapper class in your Windows Phone application:
    /// <summary>
    /// Bootstraps the sample application.
    /// </summary>
    public class SampleBootstrapper : WPForms.Phone.Bootstrapper
        /// <summary>
        /// Implementors have to provide form descriptions for all available forms in the application.
        /// </summary>
        /// <param name="descriptionCollection">The description collection.</param>        
        protected override void AddFormDescriptions(WPForms.Common.Model.FormDescriptionCollection descriptionCollection)
            descriptionCollection.Add(new WPForms.Common.Model.FormDescription()
                FormName = "Webshop Registration",
                Uri = new Uri("/PhoneSample;component/Resources/SampleForm.xaml", UriKind.Relative),


3.2. Run the bootstrapper on startup
To start the framework your bootstrapper has to run when the application starts.
Edit the App.xaml.cs to include initialization:
        /// <summary>
        /// The sample application's bootstrapper.
        /// </summary>
        private SampleBootstrapper bootstrapper;

        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)

        // Code to execute when the application is activated (brought to foreground)
        // This code will not execute when the application is first launched
        private void Application_Activated(object sender, ActivatedEventArgs e)
            if (!e.IsApplicationInstancePreserved)

        /// <summary>
        /// Initializes the wp forms framework.
        /// </summary>
        private void InitializeFramework()
            if (this.bootstrapper == null)
                this.bootstrapper = new SampleBootstrapper();

4. Configure your application

4.1. Resources
  • To display your application's name properly, you have to add a string resource to the application resources: <sys:String x:Key="AppName">WPForms Sample</sys:String>
  • To enable SkyDrive backup add your Live Client id to the resources: <sys:String x:Key="LiveClientId"></sys:String>
  • To enable reverse geocoding add your Bing Maps Key to the resources: <sys:String x:Key="BingMapsKey"></sys:String>

4.2. Startup page
To fill out your form navigate to the FormCollection page: WPForms.Phone;component/View/FormCollection.xaml

Or you can set it to be the start page in the WMAppManifest.xml: <DefaultTask Name ="_default" NavigationPage="WPForms.Phone;component/View/FormCollection.xaml"/>

Last edited Nov 2, 2012 at 10:55 AM by csabakiss, version 3


No comments yet.