如果显示是ItemsControl.ItemsSource空 [英] Show if ItemsControl.ItemsSource is null

查看:141
本文介绍了如果显示是ItemsControl.ItemsSource空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候,

我有一个ItemsControl的我改变了模板来显示单选按钮在绑定的ItemsSource的每一个对象。

I have a ItemsControl which template I changed to show a RadioButton for every object in the binded ItemsSource.

然而,的ItemsSource可以是空的,当它是空的,我想展现一个默认值。喜欢的东西的绑定列表中没有的项目供您选择...

However the ItemsSource can be empty and when it is empty I'd like to show a default value. Something like "The binded list contains no items for you to select"...

我想到的一个方法是将ItemsControl.Visibility设置为折叠,并有一个TextBlock .Vsibility到可见其显示文本。但是这将包括更多数据。

One way I thought of is to set the ItemsControl.Visibility to Collapsed and have a TextBlock.Vsibility to Visible which shows the text.. But this would include a lot more data.

是否有可能显示一个默认值,如果ItemsControl.ItemsSource为空?

Is it possible to show a default value if the ItemsControl.ItemsSource is null?

推荐答案

如果我理解正确的话,我想你可以通过创建一个的IValueConverter

If I understood correctly, I think you can solve your problem by creating an IValueConverter.

这篇关于如果显示是ItemsControl.ItemsSource空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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