Create First Windows 8 Mobile Application Development

This article explains how to create your first Windows 8 Mobile App.

Yesterday I created a demo Windows Phone 8 application. I want to share my first small app with you all. This article explains how to create your first Windows 8 Mobile App. This article may be helpful for beginners in Windows Store apps development.

First of all, you should have a proper machine configuration with SDK for Windows apps development.

Use the following procedure before starting application development:

  • Install Windows 8 Mobile SDK.
  • Enable Hyper-V from Control Panel by selecting "Programs and Features" -> "Turn Windows features on or off".

    The following image is for reference:

    Turn Windows features
     
  • Enable virtualization from BIOS settings -> "Advanced options".

To create this application I used Visual Studio 2013 and Windows 8 64 bit.

In this application I created the two buttons, Play and Stop.

  1. Play: start music
  2. Stop: stop music

Use the following procedure to create the Window 8 Phone Application:

  1. Open Visual Studio 2013
  2. "File" -> "New" -> "Project..."
  3. Under "Visual C#" then select "Windows Phone"
  4. Choose "Windows Phone app"
  5. Enter the name "Music Player"

Windows phone app

You will now see the following screen:

Windows phone page

You can now change your header from Stackpanel. I changed my application to "Nokia Music Player" and set the page name to "Music Player".

Then add two buttons, Play and Stop, using the following markup in the Grid Content Panel:

<Button Height="200" Name="Play" Width="200" Background="blue" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Play_Click">Play Song</Button>

<Button Height="200" Name="Stop"Width="200" Background="blue" HorizontalAlignment="Right" VerticalAlignment="Top"  Click="Stop_Click">Stop</Button>

<MediaElement x:Name="QuickMediaElement" Source="/Assets/Sound/song.mp3" AutoPlay="False"></MediaElement>

I created two buttons and their Click event. I added a Media element tag that contains a source (a mp3 song) with song.mp3 for the Assets/sound folder.

 
adding a Media element tag

To generate a Click event of the buttons write "Click" and it will show you a suggestion as in the following:



Now click on the New Event Handler. It will create a Play_Click and Stop_Click on MainPage.xaml.cs page automatically.

Now in the cs page enter the following.

To Play

private void Play_Click(object sender, RoutedEventArgs e)
{
    QuickMediaElement.Play();
}

To Stop

private void Stop_Click(object sender, RoutedEventArgs e)

{

   QuickMediaElement.Stop();

}

Your First Demo application is ready now. Run Application using the Emulator. When you start your emulator the first time it will take some time.

Run application using Emulator

Here is your first Windows 8 Mobile Application. Enjoy your own Nokia Music Player.

Windows 8 Mobile Application