Welcome!

Java Authors: Jerry Melnick, Elizabeth White, Liz McMillan, Andreas Grabner, Tim Hinds

Blog Feed Post

Android to Windows 8 Part 3: Exploring the Windows Store Project

Over the past several weeks I’ve been working on some content I’m excited to finally share with you through a series of blog posts. This series will introduce you to Windows 8 development from an Android developer’s perspective. Through the course of the series you’ll create your first app. It won’t be anything pretty, but you’ll learn the ins and outs of the development environment, how to create a simple user interface, and how to perform navigation. Along the way you’ll see some Android Hints that will help make it easier for you to transition your existing skills to the Windows platform. You’ll also see some Visual Studio Tips to make you more productive in your development environment. Good luck!

In the last lesson you created your first Windows Store project. In this lesson you’ll spend some time exploring the project and learning about some key files and directories.

Package.appxmanifest


This is the application’s manifest. It is an XML document that contains the information the system needs to deploy, display, or update a Window Store app.

ANDROID HINT

Package.appxmanifest is similar to the AndroidManifest.xml file used by Android applications.

 

Here is some additional information about the manifest:

  • It includes package identity, package dependencies, required capabilities, visual elements, and extensibility points.
  • Every app package must include one package manifest.
  • The manifest is digitally signed as part of the signing the app package.
  • After signing, you can’t modify the manifest without invalidating the package signature.
  • After the package has been installed, the package manifest file appears in the directory for the installed package.

If you double-click the manifest in the solution explorer you’ll get a UI you can use to edit the various properties of the manifest. For this app we’ll leave everything as is.

MainPage.xaml and MainPage.xaml.cs


As mentioned in the last lesson XAML (eXtensible Application Markup Language) is the declarative language used to create the UI for Windows Store applications. MainPage.xaml is the default page for your application. This is where you’ll create your simple UI (in the next lesson). MainPage.xaml.cs is the associated C# code that goes along with your UI.

VISUAL STUDIO TIP

The *.xaml.cs file that is associated with a *.xaml file is called the code-behind file.

 

ANDROID HINT

The relationship between *.xaml and *.xaml.cs files is similar to the relationship between layouts and activities in Android development. When you create a generic Android app, you’ll get an activity_main.xml file in the res > layout
directory. This is where you define the UI for your Android app. You also get a MainActivity.java file in your src directory. This is where you write the code that goes along with the UI. In our app MainPage.xaml corresponds to activity_main.xml, and MainPage.xaml.cs corresponds to MainActivity.java

 

App.xaml and App.xaml.cs


App.xaml can be used to store information about application wide resources. By default a ResourceDictonary is added that refers to the StandardStyles.xaml file in the Common directory. (More on that in a minute).

App.xaml.cs provides application-specific behavior to supplement the default application class. This is where the connection to MainPage.xaml as the default page for the application is wired up

ANDROID HINT

In the generic Android app example I mentioned earlier, you set the default activity for the app in AndroidManifest.xml. Typically it looks something like this:

If you open up App.xaml.cs and navigate to the bottom of the OnLaunched method you’ll see the following:

This is what tells the app to display MainPage.xaml when it starts.

 

Assets Directory

The Assets directory contains default artwork used for the application’s tiles, splash screen, etc.

ANDROID HINT

The items contained in the Assets directory are similar to those found in the res/drawable-* directories of your Android projects.

 

Common Directory

The Common directory contains resources used across the application. By default it contains one file, StandardStyles.xaml. This file gives you the styles you need for your app to look like a Windows 8 (i.e. Metro application). You are not required to use it, but it’s a great resource for those of us who are design challenged.

As you can see, Visual Studio gives you a lot for free so you can get started on your app. You should continue to explore your project set up as well as the files and directories that get created with the of the other project templates as Visual Studio does a lot of heavy lifting for you.

In the next lesson you’ll learn how to run your application.

Previous Posts in this Series

  1. Setting up the Development Environment
  2. Creating Your First Windows Store Project

Additional Resources

Read the original blog entry...

More Stories By Adam Grocholski

Hey there! My name is Adam Grocholski, and I'm a Technical Evangelist at Microsoft where I spend time focusing on Windows, Windows Phone, and Windows Azure. I live in the frozen tundra of Minnesota and run thinkfirstcodelater.com. You can also follow me on twitter at @codel8r.