public void SetVisibleSite(IMainSite mainSite) { if (_currentVisibleSite != mainSite) { if (_currentVisibleSite != null) { _currentVisibleSite.RootFrameworkElement.Visibility = Visibility.Collapsed; } _currentVisibleSite = mainSite; if (!(ShellApplication.MainSite as Grid).Children.Contains(_currentVisibleSite.RootFrameworkElement)) { (ShellApplication.MainSite as Grid).Children.Add(_currentVisibleSite.RootFrameworkElement); } _currentVisibleSite.RootFrameworkElement.Visibility = Visibility.Visible; } }