空comboBox - 显示一些'list is empty'文本? [英] Empty comboBox--display some 'list is empty' text?
问题描述
有些情况下,ComboBox下拉列表将为空...而不是显示一个几乎崩溃的弹出窗口,我想在弹出窗口中显示一些文本,向用户显示没有可用的选项。
There are cases where ComboBox drop downs will be empty...rather than showing a popup that's nearly collapsed, I'd like to display some text in the popup indicating to the user that there are no choices available.
我尝试创建一个折叠的文本框,然后触发一个触发器,当ItemsPresenter.DataContext = Null时,文本框变得可见......但不幸的是,这不起作用。
I've tried creating a collapsed textbox and then a trigger where the textbox becomes visible when ItemsPresenter.DataContext=Null...but unfortunately that doesn't work.
当ItemsPresenter中没有任何内容时,是否有触发器可以将事件绑定到显示我的文本框?
Is there a trigger I can tie the event to display my textbox when there is nothing in the ItemsPresenter?
Purkiss
推荐答案
您可以在有条件可见的XAML中向ItemsSource添加元素。以下是stackoverflow.com上的示例: http://stackoverflow.com/questions/1188402/wpf -combobox-with-empty-item
希望有所帮助。
这篇关于空comboBox - 显示一些'list is empty'文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!