Monday, April 23, 2012

Visual Studio 2011 and Windows 8 for Metro style Apps for .Net Development

Windows 8 & Visual studio 2011 includes some new features that help .Net developers and ASP.Net developers for their .net development. Here we will explore Windows Runtime that can be designed for developing Metro Style Apps for .net developers who are expert in Unmanaged C++, JavaScript and .Net.

Windows Runtime (WinRT)

Metro Style Apps can be called one the coolest features in Visual Studio 2011 and Windows 8. For getting access to templates for Metro Style App the initial step would be to install VS2011 developer preview on Windows 8 Developer Preview. Windows Runtime (RT) handles these apps and RT is designed for easily developing metro style apps using the expertise of developers.

For developing web application .net developers can use HTML 5, CSS 3 and JavaScript. For accessing rich hardware functionality Javascript calls WinRT system.For developing Metro style applications .Net developers can make use of extensible application Markup language (XAML), C#, VB.NET.

Windows check all the access rights to the user data and system resources for programming with WinRT. Package Manifest specifies these access rights. The Metro Style application needs to send a quick response to the end-user and for this apps use Asynchronous operations.

As per Microsoft’s definition “Metro style apps are full screen apps tailored to your users’ needs, tailored to the device they run on, tailored for touch interaction, and tailored to the Windows user interface.

Windows helps you interact with your users, and your users interact with your app”

How to create Metro Style Apps using C#?

Step 1: Open VS2011 and create a new Windows Metro Style App as below:

You will receive below project structure after creation of application:

Step 2: You need to double click on ‘Package.appxmanifest’ for viewing the settings of application as below:

You will see information for the “Application UI” e.g. Logo as shown in the above image. Also note the size restriction for the Logo image.

Step 3: By clicking on the Capabilities tab you will get the List of System Features that the application can use.

Step 4: Click on the ‘Declaration’ Tab and by using this tab, you can add declarations for the application:

The packaging tab also allows developers for defining properties that identify and describes the package for application at the time of deployment.

Step 5: Add a new class file in the MyApp application and name it as ‘DataClasses.cs’. Below are the classes you need to add in it:

Step 6: Open MainPage.Xaml then add a ListBox and use the Databinding expression as shown below:

Step 7: By running the application you will get output in the Emulator as follows:

You are finished with it and we saw how WinRT can be used for developing Metro Style Apps by .Net developers.

No comments: