简体   繁体   English

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

[英]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? 如何分配字符串文本ListPicker的变量?

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

How to get the text from the selected item? 如何从所选项目中获取文本?

The simplest way is: 最简单的方法是:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM