Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我看来,我有不同的控件。主要是Buttons、TextBoxes 和ComboBoxes。按钮通过 CommandBinding ( ICommand) 启用/禁用,但其他控件必须“手动”启用/禁用。我可以想到很多方法来实现这一点:
Button
TextBox
ComboBox
ICommand
向 ViewModel添加bool-Property 是一种方法,而使用DataTriggers是另一种方法。(或者也许我可以直接绑定属性并使用IValueConverter.)
bool
DataTriggers
IValueConverter
MVVM 中是否有我遗漏或遗漏的特定解决方案?
是的,您可以将视图模型上的公共布尔属性绑定到IsEnabled控件的属性。不需要值转换器。
IsEnabled