Home > Articles > Mobile Application Development & Programming

  • Print
  • + Share This
From the author of Creating a Sample Windows 8 Store App

Creating a Sample Windows 8 Store App

In Visual Studio 2012, select File > New > Project. In the New Project dialog, select the Windows Store category and then select the Split App (XAML) project template, as shown in Figure 1.

Figure 1 Creating a new Windows 8 Store App.

If we chose the Blank App (XAML) template, we would need to add some helper code and styles manually; instead, these are already available in the Split App template, so choosing it requires fewer edits. Call your new project OrdersManagement and click OK. Once the new project is ready, build the solution. This is important to update the references before making any edits. After the build succeeds, remove the following items from Solution Explorer:

  • ItemsPage.xaml
  • SplitPage.xaml
  • DataModel folder

The reason is that our sample application will have its own data model based on the OData service, and it will have just one page for demonstration purposes.

The next step is adding a new, empty page where users will be able to display and edit data. Select Project > Add New Item. In the Add New Item dialog, select the Basic Page template, as shown in Figure 2.

Figure 2 Adding a new empty page to the app.

Call the new page MainPage.xaml and click OK. Now you have to specify this page as the new startup page for the application. Double-click the App.xaml.vb file in Solution Explorer, and then locate the following code block inside the OnLaunched method:

If Not rootFrame.Navigate(GetType(ItemsPage), "AllGroups") Then
    Throw New Exception("Failed to create initial page")
End If

Replace ItemsPage with MainPage as follows:

If Not rootFrame.Navigate(GetType(MainPage), "AllGroups") Then
    Throw New Exception("Failed to create initial page")
End If

You've completed the steps required to prepare the application, and you're ready to move to a more interesting part of the job: connecting to the LightSwitch OData service.

  • + Share This
  • 🔖 Save To Your Account