我如何翻转BooleanToVisibilityConverter? [英] How do I invert BooleanToVisibilityConverter?
本文介绍了我如何翻转BooleanToVisibilityConverter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在WPF中使用 BooleanToVisibilityConverter
绑定可见性控制的
属性设置为布尔
。这工作得很好,但我想其中一个控件隐藏如果布尔是真
,并显示它是否假
。
I'm using a BooleanToVisibilityConverter
in WPF to bind the Visibility
property of a control to a Boolean
. This works fine, but I'd like one of the controls to hide if the boolean is true
, and show if it's false
.
推荐答案
实现你自己的实现的IValueConverter的。示例实现是
Implement your own implementation of IValueConverter. A sample implementation is at
的http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.aspx
在您的转换方法,使其返回的值,你想,而不是缺省值。
In your Convert method, have it return the values you'd like instead of the defaults.
这篇关于我如何翻转BooleanToVisibilityConverter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文