Pages

Tuesday, August 20, 2013

How to Create a Simple Windows Store App using C#

This article will explain how to create a simple windows store app using C# and Xaml. To create windows store app must you have a windows 8 computer or higher, visual studio 2012 or higher and Microsoft Account. When you want to create windows store app at first time then its ask developer licence for windows store apps. To get developer licence you must have to login windows store apps with Microsoft Account. After login follow this steps.

Step 1
Start visual studio 2012 or higher and start new project. In new project window find Windows store apps and select 'Blank App' the give the app name and click on 'OK'.



Step 2
In step 2 go in solution explorer and double click on 'MainPage.xaml'.


Step 3
In 'MainPage.xaml' page add control within 'Grid'. Here we have add an Button, Textbox and Textbook.

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Button Content="Click" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="786,242,0,0" Click="Button_Click_1"/>
        <TextBox HorizontalAlignment="Left" Name="txtBox" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Margin="601,242,0,0" Width="180" Height="38"/>
        <TextBlock HorizontalAlignment="Left" Name="lblMsg" FontSize="25" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Margin="601,200,0,0" Width="251" />
    </Grid>

Step 4
At the click of 'Button' in 'MainPage.xaml.cs' page write following code.

private void Button_Click_1(object sender, RoutedEventArgs e)
{
    lblMsg.Text = "Hello "+txtBox.Text;
}

Step 5

Now build and run you project.

No comments:

Post a Comment