Alexis
Alexis

Reputation: 137

ListPicker, how to get the text from the selected item?

How to get the text from the selected item? How to assign a variable of type string text ListPicker?

<toolkit:ListPicker x:Name="EncodingList">
                    <toolkit:ListPickerItem HorizontalAlignment="Center" Content="UTF-8" />
                    <toolkit:ListPickerItem HorizontalAlignment="Center" Content="Windows-1251" />
        </toolkit:ListPicker>

Upvotes: 1

Views: 1671

Answers (1)

ROMAN
ROMAN

Reputation: 1576

How to get the text from the selected item?

The simplest way is:

var content = ((ListPickerItem)EncodingList.SelectedItem).Content;

Upvotes: 3

Related Questions