Windows Phone 7 App to Show "Hello World" on Screen
Join the DZone community and get the full member experience.
Join For Freeoverview
the windows phone 7 sdk prerequisites are as in the following:
- it is supported by operating systems like windows 7 and windows vista with service pack 2
- it requires free disk space for installation on the system drive
- it requires a minimum of 3gb of ram on the system
the windows phone emulator requires a directx 10 or above.
it is compatible with versions of visual studio 2010 with service pack 1.
the windows phone sdk includes the following:
- it is available in windows phone emulator.
- it is available in windows phone sdk 7.1 assemblies
- it is available in sliverlight 4 sdk and drt.
- it is available in wcf data services client for windows phone and so and so.
note: sdk is nothing, it is a software development kit.
we will now create a new project for windows phone using visual studio 2010 as in the following procedure:
- open visual studio 2010 and select "file" -> "new" -> "project..."
- then, the new project window will appear as in the following:
- then select sliverlight for windows phone -> windows phone application
- then enter the name and location and click the ok button
- then, the new windows phone application window will appear
- select the target windows phone os version like windows phone os 7.1 in the dropdown box. then, click the ok button
- then, the helloworldapps project has been successfully created.
xaml code
<phone:phoneapplicationpage x:class="helloworldapps.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:microsoft.phone.controls;assembly=microsoft.phone" xmlns:shell="clr-namespace:microsoft.phone.shell;assembly=microsoft.phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designwidth="480" d:designheight="768" fontfamily="{staticresource phonefontfamilynormal}" fontsize="{staticresource phonefontsizenormal}" foreground="{staticresource phoneforegroundbrush}" supportedorientations="portrait" orientation="portrait" shell:systemtray.isvisible="true"> <!--layoutroot is the root grid where all page content is placed--> <grid x:name="layoutroot" background="transparent"> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="*"/> </grid.rowdefinitions> <!--titlepanel contains the name of the application and page title--> <stackpanel x:name="titlepanel" grid.row="0" margin="12,17,0,28"> <textblock x:name="applicationtitle" text="my application" style="{staticresource phonetextnormalstyle}"/> <textblock x:name="pagetitle" text="hello world" margin="9,-7,0,0" style="{staticresource phonetexttitle1style}"/> </stackpanel> <!--contentpanel - place additional content here--> <grid x:name="contentpanel" grid.row="1" margin="12,0,12,0"></grid> </grid> <!--sample code showing usage of applicationbar--> <!--<phone:phoneapplicationpage.applicationbar> <shell:applicationbar isvisible="true" ismenuenabled="true"> <shell:applicationbariconbutton iconuri="/images/appbar_button1.png" text="button 1"/> <shell:applicationbariconbutton iconuri="/images/appbar_button2.png" text="button 2"/> <shell:applicationbar.menuitems> <shell:applicationbarmenuitem text="menuitem 1"/> <shell:applicationbarmenuitem text="menuitem 2"/> </shell:applicationbar.menuitems> </shell:applicationbar> </phone:phoneapplicationpage.applicationbar>--> </phone:phoneapplicationpage>
conclusion
i hope this article will help you to understand how to create a sample program for windows phone 7 using visual studio 2010.
Opinions expressed by DZone contributors are their own.
Comments