列表框选择 [英] List BOX selection

查看:89
本文介绍了列表框选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从列表框中获取选定的值:getselectedItem或ListBox.Text不起作用

I need to get the selected value from list box : getselectedItem or ListBox.Text doesn''t work

推荐答案

使用ListBox.SelectedValue 属性
Use ListBox.SelectedValue property


尝试((ListBoxItem)listBox1.SelectedValue).Content.ToString()
Try ((ListBoxItem)listBox1.SelectedValue).Content.ToString()


字符串str = listbox1.SelectedItem.ToString();
string str=listbox1.SelectedItem.ToString();


这篇关于列表框选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆