在组合框上显示我选择的项目文本 [英] Show my selected item text on combobox

查看:61
本文介绍了在组合框上显示我选择的项目文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





WPF ComboBox不显示所选项目。如何显示所选文字。



for循环...



Hi,

WPF ComboBoxes not displaying the selected item. how to show that selected text.

for loop...

ComboBoxItem yrbDef = new ComboBoxItem();
Content = "None";
cbExisProj.Items.Add(yrbDef);



这里我无法显示所选文字,也无法获得价值。





谢谢

GSS


here i cant show the selected text and also cant able to get the value also.


Thanks
GSS

推荐答案

当然它没有显示该项目,因为你只有添加它。

您还必须将所选索引更改为最近添加的项目的索引。



Of course its not showing the item, cause you've only added it.
You also have to change the selected index to the index of the recently added item.

comboBox.SelectedIndex = comboBox.Items.Add(cbItem);


这篇关于在组合框上显示我选择的项目文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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