如何将启用/禁用状态绑定到控件而不是视图模型? [英] How to bind enabled/disabled status to a control instead of view model?
本文介绍了如何将启用/禁用状态绑定到控件而不是视图模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通常,我会将启用/禁用(或可见/隐藏/折叠)的状态绑定到视图模型中的属性。但是,我想知道在特定情况下使用单选按钮是否有更流畅的方法。
Usually, I'd bind a status of being enabled/disabled (or visible/hidden/collapsed) to a property in the view model. However, I wonder if there's a smoother way in the particular case with radio buttons.
我有一组三个单选按钮,当我选择其中一个时,我d想使某个文本框启用(或可见)。当我选中另一个单选按钮时,希望该文本框被禁用(或隐藏)。
I have a set of three radio buttons and when I select one of them, I'd like to make a certain text box to become enabled (or visible). When I check another radio button, I wish the text box to become disabled (or hidden).
如何将控件的属性绑定到另一个控件的状态?
How do I bind property of a control to a state of another control?
推荐答案
{Binding ElementName=myControl, Path=myProperty}
您可能还需要转换器
这篇关于如何将启用/禁用状态绑定到控件而不是视图模型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文