beny lim
beny lim

Reputation: 1304

Listpicker in windows phone 7

I am trying to use the listpicker control in windows phone 7. Such that i am trying to get the value of the selected item from the listpicker.

Below is my code for the listpicker.

 this.queListPicker.ItemsSource = new List<string>() {"5", "10", "15" };

I want it to be something like when i click on the listpicker and clicked on "10" i will have a textblock showing the value of 10. While when i click on 15 it will show the value of 15 in the text block

How should i go about doing it?

Upvotes: 1

Views: 1319

Answers (2)

Peter Wone
Peter Wone

Reputation: 18739

Use a binding to picker.SelectedItem

Upvotes: 0

wooncherk
wooncherk

Reputation: 1364

You can handle the SelectionChanged event of the listpicker. You can then get the corresponding argument (such as the item being selected) using the SelectionChangedEventArgs of the event. Many list controls such as ListBox has similar approach (same event), so you might want to get started from ListBox.

Upvotes: 1

Related Questions