LIstBox问题

DENQH 2012-11-16 06:06:22


Dictionary<string, string>  dic= new Dictionary<string, string>();
dic.Add("name","john");
Lbox3.ItemsSource=dic
Lbox3.DisplayMemberPath = "Value";

private void Lbox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string str= Lbox3.SelectedItem.ToString()//这样是不可以的,怎么读取?
}
...全文
100 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
DENQH 2012-11-16
  • 打赏
  • 举报
回复
引用 3 楼 TheDolphin 的回复:
引用 2 楼 TheDolphin 的回复:string str= Lbox3.SelectedItem.Text 错了 this.Lbox3.SelectedValue.
真他她M的,眼花了,这么低级的错误我都有犯了!
色拉油 2012-11-16
  • 打赏
  • 举报
回复
引用 2 楼 TheDolphin 的回复:
string str= Lbox3.SelectedItem.Text
错了 this.Lbox3.SelectedValue.
色拉油 2012-11-16
  • 打赏
  • 举报
回复
string str= Lbox3.SelectedItem.Text
stonespace 2012-11-16
  • 打赏
  • 举报
回复

private void Lbox1_SelectionChanged(object sender, SelectionChangedEventArgs e)        {

KeyValuePair<string,string> rPair=(KeyValuePair<string,string>)(Lbox3.SelectedItem);

string str= rPair.Key+rPair.Value;//这样是可以的,}

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧