Click here to Skip to main content
15,744,384 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

I have a project that requires me to ask the user's country and phone number. The phone number part is working fine. By itself, the country part is also working fine. Considering this a 2-page project, I have a ListView in Page2.xaml that displays a list of all countries (data bound to a .cs file (class file) that has my ViewModel). In Page1.xaml, I have a textblock (and a textbox for phone number which we don't need to worry about) whose tapped property navigates to Page2 (and displays the list of country). I would like to know:

1. How I can take the selected item from the list (that is in Page2) and display it in the textblock (in Page1).

2. If there is a 1-page way to implement this, that is, if I can show the listview itself with something like a PlaceholderText (that says Select your Country) and when it is clicked, it opens the entire list of country. This is something similar to signing up for WhatsApp or Line, or services of that sort.

Your response is appreciated.

Thank you!
Member 11526508 29-Mar-15 2:08am    
FYI, I tried to implement the local storage by putting

Windows.Storage.ApplicationDataContainer localsetting = Windows.Storage.ApplicationData.Current.LocalSettings;
lstv_countries.SelectedItem = localsetting.Values["Countries"].ToString();

in the ItemsSelection event of the ListView (Page2) and then

Windows.Storage.ApplicationDataContainer localsetting = Windows.Storage.ApplicationData.Current.LocalSettings;
localsetting.Values["Countries"] = testText.Text;

in the GotFocus event of the textblock (in Page1). This doesn't work :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900