locked
how can we get list of countries/states/cities in windows store app using c# code? RRS feed

  • Question

  • Hi,

         I would like to pull the Countries list and bind in combo box. When user chosen a country, states combo box should be populated and  when State is chosen, Cities need to be populated.. in windows store app using c# code.

    How can i get these functionalities in window store app? anyone knows please help me

    Wednesday, December 4, 2013 1:34 PM

Answers

All replies

  • Pretty easy!

    Here is an action plan for you to follow:

    1. Find a data source for countries, states and cities.  Ensure the data sources let you search for states given countries and cities given countries and states.  Note:  I have no idea where you can find this so you will need to do the research.

    2.  Built a List of countries and bind the combo box to this list.  Many of our list samples show how to do this (search in the samples for xaml list and controls)

    3.  Detect the when the selection changes on the combo box and use this either to: (again samples are where you want to go for this)

        a.  Filter a list of available cities in that country - not my first choice

        b.  Fetch the data given that country - slower but you won't pre-fetch data you won't need and less memory required.

    4.  Repeat the logic in step 3 for cities (adapting of course to city logic) and trigger this when the state combo selection changes.

    Jeff


    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Wednesday, December 4, 2013 8:29 PM
    Moderator
  • Hi,

          Thanks for your reply, what  I'm asking is, I want to load list countries, state, cities , for that first I need to get countries,states,cities without storing any database  thro my app, I want to  get these list from some common dll or from existing server. 

         because I can get countries using  System. Globalization. RegioInfo in wcf, like that  i'm searching,

    anybody knows please help me.

     

    Thursday, December 5, 2013 4:39 AM
  • Hi Malar,

    Please refer to following code sample:

    http://code.msdn.microsoft.com/How-to-create-detail-b87a60fa

    If this sample does not help, you can also submit a sample request in following site:

    http://code.msdn.microsoft.com/site/requests

    Best Regards

    • Marked as answer by Anne Jing Friday, December 20, 2013 5:43 AM
    Thursday, December 5, 2013 6:34 AM