private void ViewModel_Closed(object sender, EventArgs e) { TopTabBar.TabDraggedOutside -= TabBar_TabDraggedOutside; TopTabBar.TabWindowChanged -= TabView_Drop; TopTabBar.TabDraggingCompleted -= TabBar_TabDraggingCompleted; TopTabBar.TabDraggingChanged -= TabBar_TabDraggingChanged; BottomTabBar.TabDraggedOutside -= TabBar_TabDraggedOutside; BottomTabBar.TabWindowChanged -= TabView_Drop; BottomTabBar.TabDraggingCompleted -= TabBar_TabDraggingCompleted; BottomTabBar.TabDraggingChanged -= TabBar_TabDraggingChanged; TopTabBar.DisposalPrepare(); BottomTabBar.DisposalPrepare(); UnregisterPropertyChangedCallback(RequestedThemeProperty, _propertyChangedCallbackToken); Loaded -= OnLoaded; DraggingHappensChanged -= MainPage_DraggingHappensChanged; Window.Current.Activated -= OnWindowActivated; coreTitleBar.LayoutMetricsChanged -= OnLayoutMetricsChanged; ViewModel.Closed -= ViewModel_Closed; ViewModel = null; Root.DataContext = null; Window.Current.SetTitleBar(null); coreTitleBar = null; Bindings.StopTracking(); TerminalContainer.Content = null; }
private void UpdateTopTabsAppearence() { var background = Xamarin.Forms.Shell.GetBackgroundColor(ShellContext.Element.CurrentItem); var foreground = Xamarin.Forms.Shell.GetForegroundColor(ShellContext.Element.CurrentItem); var unselectedColor = Xamarin.Forms.Shell.GetTabBarUnselectedColor(ShellContext.Element.CurrentItem); TopTabBar.Background = background.ToBrush(); TopTabBar.ActiveColor = foreground.ToBrush(); TopTabBar.UnselectedColor = unselectedColor.ToBrush(); var index = ShellContext.Element.CurrentItem.CurrentItem.Items.IndexOf(CurrentContent); TopTabBar.SetActiveTab(index); }