public static void EnsureModuleViewModel(object view, object parentViewModel, object parameter = null) { ISupportViewModel viewModelSupport = view as ISupportViewModel; if (viewModelSupport != null) { EnsureViewModel(viewModelSupport.ViewModel, parentViewModel, parameter); } }
public static void EnsureModuleViewModel(object module, object parentViewModel, object parameter = null) { ISupportViewModel vm = module as ISupportViewModel; if (vm != null) { object oldParentViewModel = null; ISupportParentViewModel parentViewModelSupport = vm.ViewModel as ISupportParentViewModel; if (parentViewModelSupport != null) { oldParentViewModel = parentViewModelSupport.ParentViewModel; } EnsureViewModel(vm.ViewModel, parentViewModel, parameter); if (oldParentViewModel != parentViewModel) { vm.ParentViewModelAttached(); } } }