WPF中组合框的文本属性 [英] Text Property of combo box in WPF

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

问题描述




我在C#中使用WPF在WPF中使用组合框,我试图通过数据库中的代码动态更新列表,我试图使用text属性,以编写不起作用的文本"Select any option",如何在屏幕上显示"Select any option"组合框的顶部.


提前thnx




i using comboboxes in WPF with c#, i m trying to update list dynamically through code from database, i m trying to use the text property , for writing text "Select any option" which is not working, how to show "Select any option " on the top of the combo box.


thnx in advance

推荐答案

假定您将文本绑定到下拉列表,只需在绑定之前在集合中添加一行即可.
例如,-选择一个选项-".

这将自动出现在下拉菜单的顶部.
Assuming you are binding text to the dropdown, just add an additional row to the collection before the binding.
For example, "--Select an option--".

This will automatically appear on the top of the dropdown.


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

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