Windows 8 the hot topic in Operating System market, though it is not yet launched but its preview versions are doing a great job among the developers. It has launched three versions till date, Developer Preview, Consumer Preview and Release Preview. Windows App Store in windows 8 is the major attraction. In this article I will guide you to start developing applications for Windows 8.
Starting with development, we need some developer tools for windows 8:
- Visual Studio 11 or Visual Studio 12 RC
- Windows 8 SDK
- App Certification Kit
Well if you use Visual Studio 12 RC it contains all the developer tools, though Visual Studio 12 RC cannot be installed on consumer preview for this you need Developer preview or Release preview.
Create new project, Under templates section you will see Windows Metro Style:
There are three types of app which can be developed.
- Blank App – It is the minimal application for windows metro style framework. It is used to create basic applications.
- Grid App – This can be used to create multi-page project for navigating multiple layers of content with item details displayed on a detailed page. This can be used to create a panoramic view also.
- Split App – This defines two different section where you can create a project for navigating among master list of items while viewing their details on the same page.
Now the new project is created, and the MainPage.xaml will show in the main window, other files can be browsed from the solution explorer. We have a ToolBox on the left from which various controls can be drag and dropped to the design view of the MainPage.xaml or we can directly write some xaml code to add the control. As this is this first app we are going to make, we will simply add a TextBlock and add some text to it which will be shown when the app is loaded. The Fig below will show you the code snippet:
Consider the first line, here MyFirstApp is the name space and MainPage is the class. We have added a control TextBlock and added few attributes like HorizontalAlignment and VerticalAllignment, we have set both of them to Center so that our text comes in center. And now you are done with your very first and Simple App. This can be debugged in various modes like debug in the Local Machine, Simulator and Remote Machine. I prefer debugging it in Simulator. It will look something like this.
Here is the Source Code.