示例#1
0
        protected bool SwitchView(Type viewType)
        {
            ContainerChildViewModelBase oldView = _selectedView;

            foreach (ContainerChildViewModelBase view in _views)
            {
                var masterVM = view as ContainerViewModelBase;
                if (view.GetType() == viewType)
                {
                    if (Set(() => SelectedView, ref _selectedView, view))
                    {
                        OnSelectedViewChanged(oldView, _selectedView);
                    }
                    return(true);
                }
                if (masterVM != null && masterVM.SwitchView(viewType))
                {
                    if (Set(() => SelectedView, ref _selectedView, view))
                    {
                        OnSelectedViewChanged(oldView, _selectedView);
                    }
                    return(true);
                }
            }

            return(false);
        }
示例#2
0
 protected virtual void OnSelectedViewChanged(ContainerChildViewModelBase oldView, ContainerChildViewModelBase newView)
 {
     if (oldView != null)
     {
         oldView.IsSelected = false;
     }
     newView.IsSelected = true;
 }
示例#3
0
 protected virtual void OnSelectedViewChanged(ContainerChildViewModelBase oldView, ContainerChildViewModelBase newView)
 {
     if (oldView != null)
         oldView.IsSelected = false;
     newView.IsSelected = true;
 }