protected override void OnBindingContextChanged(VMBase oldViewModel, VMBase newViewModel) { base.OnBindingContextChanged(oldViewModel, newViewModel); VMBaseMap oldVm = oldViewModel as VMBaseMap; if (oldVm != null) { oldVm.MapId.OnValueChanged -= MapIdChanged; oldVm.Tiles.OnValueChanged -= TilesChanged; oldVm.Characters.OnValueChanged -= CharactersChanged; } if (ViewModel != null) { ViewModel.MapId.OnValueChanged += MapIdChanged; ViewModel.Tiles.OnValueChanged += TilesChanged; ViewModel.Characters.OnValueChanged += CharactersChanged; } }
public MBaseMap() { viewModel = new VMBaseMap(); }