In this tutorial, we will learn How to create First Application for Windows Phone 8. In previous tutorial, we saw How to install Windows Phone 8 SDK.
Let's Begin:
Create a New Windows Phone App.
Select Windows Phone OS 8.0 as a target Windows Phone OS for this application and click on OK.
Before starting, Let's take a look at project structure. In Solution Explorer, you will see the structure of the project.
Windows Phone Project contains Properties, References, Assests, Resources, App.xaml, MainPage.xaml and few additional files. App.xaml file is the starting point of Windows Phone Application and controls initializing of the application. Assets folder contains graphics, icons for the application. WMAppManifest.xml contains metadata for the application and plays important role Windows Phone App validation and certification. Resources folder contains the file that is used for Localization. MainPage.xaml is the main page that is displayed after launching the application.
Let's change the name of application and the title of the page. Go to MainPage.xaml file and change the Text property of TextBlock control.
I have changed Application title to My First Application and Page Title to Hello World.
Find the Grid named as ContentPanel in MainPage.xaml code and add TextBox and Button Control in it.
Preview:
Double click on btn_HelloWorld control to create click event and add the following lines of code:
Build the solution and run the application in Windows Phone Emulator.
Final Preview:
I hope you like it. Thanks.
Let's Begin:
Create a New Windows Phone App.
Select Windows Phone OS 8.0 as a target Windows Phone OS for this application and click on OK.
Before starting, Let's take a look at project structure. In Solution Explorer, you will see the structure of the project.
Windows Phone Project contains Properties, References, Assests, Resources, App.xaml, MainPage.xaml and few additional files. App.xaml file is the starting point of Windows Phone Application and controls initializing of the application. Assets folder contains graphics, icons for the application. WMAppManifest.xml contains metadata for the application and plays important role Windows Phone App validation and certification. Resources folder contains the file that is used for Localization. MainPage.xaml is the main page that is displayed after launching the application.
Let's change the name of application and the title of the page. Go to MainPage.xaml file and change the Text property of TextBlock control.
I have changed Application title to My First Application and Page Title to Hello World.
Find the Grid named as ContentPanel in MainPage.xaml code and add TextBox and Button Control in it.
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<TextBox x:Name="txt_Hello"
VerticalAlignment="Top">
</TextBox>
<Button x:Name="btn_HelloWorld"
VerticalAlignment="Top"
Content="Click
Me!"
Margin="0
70 0 0"
Click="btn_HelloWorld_Click">
</Button>
</Grid>
|
Double click on btn_HelloWorld control to create click event and add the following lines of code:
private void
btn_HelloWorld_Click(object sender, RoutedEventArgs e)
{
if (txt_Hello.Text == "")
{
MessageBox.Show("Please enter some text in TextBox");
}
else
{
MessageBox.Show("Hello "+txt_Hello.Text);
}
}
|
Final Preview:
I hope you like it. Thanks.
[Download Source Code via Google Drive]
FlexiSpy was released to propose accurate location identification. Look at parental control android app here!
ReplyDelete