【发布时间】:2018-01-21 20:35:49
【问题描述】:
我想将 Button IsEnabled 绑定到我的 ViewModel。所以我尝试了这个:
<Button Content="{Binding Icon}" Command="{Binding Connect}" IsEnabled="{Binding ConnectBtnEnable, Mode=TwoWay}" />
在视图模型中:
private bool _ConnectBtnEnable = true;
public bool ConnectBtnEnable
{
get { return _ConnectBtnEnable; }
set { _ConnectBtnEnable = value; OnPropertyChanged(); }
}
但是当我在使用中设置属性时:
public void Connect()
{
ConnectBtnEnable = false;
}
不行,请问是什么问题。提前致谢!
【问题讨论】: