wpf中的组合框文本 [英] combobox text in wpf

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

问题描述

当我从组合框中选择值时,所以它的文本必须得到更改na ??



它仍然显示组合框文本中的先前值。

当我在字符串变量中选择item.tostring()时,

它显示空(即)值或以前的值..



所以我将事件更改为lost_focus()但是它会产生更多问题..



我的相同代码在windows窗体中工作但是不是在wpf。



我在哪里错了?

或者还有其他方法可以在wpf中获取文本吗?

when i select value from combobox, so its text must be get change na ??
.
it still shows previous value in combobox text.
also when i take selected item.tostring() in a string variable,
it shows empty(i.e "") value or previous value..
.
so i change the event to lost_focus() but it creates more problems..
.
my same code is workin in windows form but not in wpf.

am i going wrong anywhere ?
or there is any other way to get text in wpf ??

推荐答案

得到答案..



got The Answer..
.
Designation = ((ComboBoxItem)cmbdesignation.SelectedItem).Content.ToString();





Thanx For Suggetions ...



Thanx For Suggetions...


你必须这样做



You will have to do this

((ComboBoxItem)comboboxxid.SelectedItem).Tag.ToString()


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

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