7 mobile,Windows Phone Application">

Country Application for Window 7 mobile

In this article, I am going to show you a Country Application. User will select country from drop down and details of selected country will be displayed.


Objective 

In this article, I am going to show you a Country Application. User will select country from drop down and details of selected country will be displayed. 

Expected Output 

1.gif 

We will achieve this in three steps 
  1. Create XML file for country and corresponding details. And create entity class. 
  2. Design phone page 
  3. Write code behind to handle selection change event and query XML file using LINQ 
Very first create Windows Phone Application.  From Silverlight for Windows Phone tab select Windows Phone Application project type. 

2.gif

Creating entity class and XML file as Data source 

Right click and add a new item in the project. Select XML file. Then copy paste the below code in that XML file. This XML file contains details of countries.  Give a proper name to XML file. Name I am giving here is CountryDetail.XML.

CountryDetail.xml

<?xml version="1.0" encoding="utf-8" ?>
<Countries>
  <Country>
    <Name>USA</Name>
    <Capital>Washinton DC</Capital>
    <Language>English</Language>
    <Currency>Dollars</Currency>
  </Country>
  <Country>
    <Name>England</Name>
    <Capital>London </Capital>
    <Language>English</Language>
    <Currency>Pounds</Currency>
  </Country>
  <Country>
    <Name>France</Name>
    <Capital>Paris </Capital>
    <Language>French</Language>
    <Currency>Euro</Currency>
  </Country>
  <Country>
    <Name>Germany</Name>
    <Capital>Berlin </Capital>
    <Language>German</Language>
    <Currency>Mark</Currency>
  </Country>
  <Country>
    <Name>Russia</Name>
    <Capital>Moscow </Capital>
    <Language>Russian</Language>
    <Currency>Not Availaible</Currency>
  </Country>
  <Country>
    <Name>Spain</Name>
    <Capital>Madrid </Capital>
    <Language>Spanish</Language>
    <Currency>Not Availaible</Currency>
  </Country>
  <Country>
    <Name>Turkey</Name>
    <Capital>Ankara </Capital>
    <Language>Not Availaible</Language>
    <Currency>Not Availaible</Currency>
  </Country>
  <Country>
    <Name>Norway</Name>
    <Capital>Oslo </Capital>
    <Language>Not Availaible</Language>
    <Currency>Not Availaible</Currency>
  </Country>
  <Country>
    <Name>Canada</Name>
    <Capital>Ottawa </Capital>
    <Language>English</Language>
    <Currency>Dollars</Currency>
  </Country>
  <Country>
    <Name>Mexico</Name>
    <Capital>Mexico </Capital>
    <Language>Spanish</Language>
    <Currency>Peso</Currency>
  </Country>
  <Country>
    <Name>China</Name>
    <Capital>Bejing </Capital>
    <Language>Chinnes</Language>
    <Currency>Not Availaible</Currency>
  </Country>
  <Country>
    <Name>Japan</Name>
    <Capital>Tokyo </Capital>
    <Language>Jaopanese</Language>
    <Currency>Yen</Currency>
  </Country>
  <Country>
    <Name>India</Name>
    <Capital>New Delhi </Capital>
    <Language>Hindi</Language>
    <Currency>Ruppies</Currency>
  </Country>
  <Country>
    <Name>Australia</Name>