ListPicker,如何从所选项目中获取文本?

时间:2013-12-07 12:54:39

标签: c# windows-phone-8

如何从所选项目中获取文字?如何分配字符串文本ListPicker的变量?

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

1 个答案:

答案 0 :(得分:3)

  

如何从所选项目中获取文字?

最简单的方法是:

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