最简单的方法是将
isMapEditOn
在财产中如果希望从源代码发出更改通知,则需要实现inotifyPropertyChanged(此处未显示)。见
this
有关实现此接口的信息,请参见第页):
private bool _isMapEditOn = false;
public bool IsMapEditOn
{
get
{
return _isMapEditOn;
}
set
{
_isMapEditOn = value;
}
}
OnLoadFunction()
{
//Bindings
Binding mapEditBind = new Binding("IsMapEditOn") { Source = this, Mode = BindingMode.TwoWay };
//Bind to check or uncheck the mapEdit Checkbox
ChckEditMap.SetBinding(ToggleButton.IsCheckedProperty, mapEditBind);
//Bind to disable children (point and area buttons).
EditBtnContainer.SetBinding(IsEnabledProperty, mapEditBind);
}