Hello World Windows Store App Using C#

Introduction

In this article we will create a "Hello World" Windows Store (Metro) App using C#. It's a simple app to open a Windows picture library.

Step 1

We will select the "C#" template Windows Store Blank App.

open-windows-store-Blank-App.jpg

Step 2

We will add a simple button control with click event.

simple-button-control-windows-store.jpg

If we right-click the "Button_Click_1" event name in XAML and click the "Navigate to Event Handler", it will redirect to the code behind file of this method. It's similar to double-clicking the button in our existing Windows/Web UI.

navigate-to-event-handler-windows-store.jpg

It will result in the UI being as shown below:

result-the-UI-Windows-store.jpg


Step 3

Navigate to the button click event and add the following code to show the alert message using the WinRT API.

navigate-to-button-windows-store.jpg

And we will see the result as shown below:

result-windows-store.jpg

Step 4

Using the WinRT API, we will use the Pickers object to select the file with ".jpg" format.

picker-object-windows-store.jpg

We will see the result as below:

final-output-windows-store.jpg

Summary

We need to use the System.IO namespace to do the Windows file related operations. But we are able to do that using the WinRT API in C#.


Similar Articles