private void ExtendAcrylicIntoTitleBar() { Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; Windows.UI.ViewManagement.ApplicationViewTitleBar titleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar; titleBar.ButtonBackgroundColor = Windows.UI.Colors.Transparent; titleBar.ButtonInactiveBackgroundColor = Windows.UI.Colors.Transparent; }
public MainPage() { this.InitializeComponent(); titleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar; coreTitleBar = Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar; CustomerTitleBar(); _instance = this; InitMapData(); cmd_MyFlight.IsEnabled = false; mapZoomLevel = themap.ZoomLevel; themap.ZoomLevelChanged += Themap_ZoomLevelChanged; frm_Main.Navigated += Frm_Main_Navigated; }
public void UpdateTitleBarAndColor(bool bShowTitleBar) { Windows.UI.Color backgroundColor = ViewModelLocator.Settings.MenuBackgroundColor; Windows.UI.Color foregroundColor = ViewModelLocator.Settings.MenuForegroundColor; waitRingRectangle.Fill = new Windows.UI.Xaml.Media.SolidColorBrush(ViewModelLocator.Settings.BackgroundColor); bool darkTheme = !ViewModelLocator.Settings.LightTheme; if (coreTitleBar != null) { coreTitleBar.IsVisibleChanged -= CoreTitleBar_IsVisibleChanged; coreTitleBar.LayoutMetricsChanged -= CoreTitleBar_LayoutMetricsChanged; coreTitleBar = null; } if (coreTitleBar == null) { coreTitleBar = Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar; coreTitleBar.IsVisibleChanged += CoreTitleBar_IsVisibleChanged; coreTitleBar.LayoutMetricsChanged += CoreTitleBar_LayoutMetricsChanged; } coreTitleBar.ExtendViewIntoTitleBar = true; if (bShowTitleBar == true) { TitleBar.Background = new Windows.UI.Xaml.Media.SolidColorBrush(backgroundColor); MainTitleBarTextBlock.Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(foregroundColor); if (coreTitleBar.Height > 0) { TitleBar.Height = coreTitleBar.Height; } Window.Current.SetTitleBar(MainTitleBar); } else { Window.Current.SetTitleBar(null); } hamburgerMenu.PaneBackground = new Windows.UI.Xaml.Media.SolidColorBrush(backgroundColor); Windows.UI.ViewManagement.ApplicationViewTitleBar formattableTitleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar; formattableTitleBar.ButtonForegroundColor = foregroundColor; formattableTitleBar.ForegroundColor = foregroundColor; formattableTitleBar.ButtonHoverForegroundColor = foregroundColor; formattableTitleBar.ButtonInactiveForegroundColor = foregroundColor; formattableTitleBar.ButtonForegroundColor = foregroundColor; if (bShowTitleBar == false) { formattableTitleBar.BackgroundColor = Windows.UI.Colors.Transparent; formattableTitleBar.ButtonBackgroundColor = Windows.UI.Colors.Transparent; formattableTitleBar.ButtonHoverBackgroundColor = Windows.UI.Colors.Transparent; formattableTitleBar.ButtonInactiveBackgroundColor = Windows.UI.Colors.Transparent; // AppLogo.Opacity = 0.5; // MainTitleBar.Opacity = 0.5; } else { formattableTitleBar.BackgroundColor = backgroundColor; formattableTitleBar.ButtonBackgroundColor = backgroundColor; formattableTitleBar.ButtonHoverBackgroundColor = backgroundColor; formattableTitleBar.ButtonInactiveBackgroundColor = backgroundColor; // AppLogo.Opacity = 1; // MainTitleBar.Opacity = 1; } if (darkTheme == true) { if (this.RequestedTheme != ElementTheme.Dark) { this.RequestedTheme = ElementTheme.Dark; } } else { if (this.RequestedTheme != ElementTheme.Light) { this.RequestedTheme = ElementTheme.Light; } } if (string.Equals(Information.SystemInformation.SystemFamily, "Windows.Xbox", StringComparison.OrdinalIgnoreCase)) { this.Background = new Windows.UI.Xaml.Media.SolidColorBrush(this.ViewModelLocator.Settings.MenuBackgroundColor); Windows.UI.Xaml.Controls.Frame ui = this.Parent as Windows.UI.Xaml.Controls.Frame; if (ui != null) { ui.Background = this.Background; } } }
public ExtendedSplash(SplashScreen splashscreen, bool loadState) { InitializeComponent(); dispatcher = Window.Current.Dispatcher; // Set Minimum size for the view Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SetPreferredMinSize(new Windows.Foundation.Size { Height = 240, Width = 320 }); ViewModels.ViewModel vm = new ViewModels.ViewModel(); this.Background = new Windows.UI.Xaml.Media.SolidColorBrush(vm.Settings.MenuBackgroundColor); progressRing.Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(vm.Settings.MenuForegroundColor); // Listen for window resize events to reposition the extended splash screen image accordingly. // This is important to ensure that the extended splash screen is formatted properly in response to snapping, unsnapping, rotation, etc... Window.Current.SizeChanged += new WindowSizeChangedEventHandler(ExtendedSplash_OnResize); ScaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel; splash = splashscreen; if (splash != null) { // Register an event handler to be executed when the splash screen has been dismissed. splash.Dismissed += new TypedEventHandler <SplashScreen, Object>(DismissedEventHandler); // Retrieve the window coordinates of the splash screen image. //splashImageRect = splash.ImageLocation; //PositionImage(); } // Create a Frame to act as the navigation context rootFrame = new Frame(); this.Loaded += ExtendedSplash_Loaded; // Update Title bar waitRing.Visibility = Visibility.Visible; Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true; Windows.UI.ViewManagement.ApplicationViewTitleBar formattableTitleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar; if (formattableTitleBar != null) { formattableTitleBar.BackgroundColor = vm.Settings.MenuBackgroundColor; formattableTitleBar.ForegroundColor = vm.Settings.MenuForegroundColor; formattableTitleBar.InactiveBackgroundColor = vm.Settings.MenuBackgroundColor; formattableTitleBar.InactiveForegroundColor = vm.Settings.MenuForegroundColor; formattableTitleBar.ButtonBackgroundColor = vm.Settings.MenuBackgroundColor; formattableTitleBar.ButtonHoverBackgroundColor = vm.Settings.MenuBackgroundColor; formattableTitleBar.ButtonInactiveBackgroundColor = vm.Settings.MenuBackgroundColor; formattableTitleBar.ButtonPressedBackgroundColor = vm.Settings.MenuBackgroundColor; formattableTitleBar.ButtonForegroundColor = vm.Settings.MenuForegroundColor; formattableTitleBar.ButtonHoverForegroundColor = vm.Settings.MenuForegroundColor; formattableTitleBar.ButtonInactiveForegroundColor = vm.Settings.MenuForegroundColor; formattableTitleBar.ButtonPressedForegroundColor = vm.Settings.MenuForegroundColor; } }
/// <summary> /// Вызывается при обычном запуске приложения пользователем. Будут использоваться другие точки входа, /// например, если приложение запускается для открытия конкретного файла. /// </summary> /// <param name="e">Сведения о запросе и обработке запуска.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { // получаем ссылку на внешний вид приложения Windows.UI.ViewManagement.ApplicationView appView = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView(); // минимальный размер 300х250 //appView.SetPreferredMinSize(new Size(300, 250)); // установка заголовка appView.Title = "Библиографический парсер"; // получаем ссылку на TitleBar Windows.UI.ViewManagement.ApplicationViewTitleBar titleBar = appView.TitleBar; Frame rootFrame = Window.Current.Content as Frame; // Не повторяйте инициализацию приложения, если в окне уже имеется содержимое, // только обеспечьте активность окна if (rootFrame == null) { // Создание фрейма, который станет контекстом навигации, и переход к первой странице rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Загрузить состояние из ранее приостановленного приложения if (ApplicationData.Current.LocalSettings.Values.ContainsKey("navHistory")) { rootFrame.SetNavigationState(ApplicationData.Current.LocalSettings.Values["navHistory"].ToString()); } } // Размещение фрейма в текущем окне Window.Current.Content = rootFrame; // устанавливаем обработчик SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;; rootFrame.Navigated += (s, args) => { if (rootFrame.CanGoBack) // если можно перейти назад, показываем кнопку { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; } else { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } }; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // Если стек навигации не восстанавливается для перехода к первой странице, // настройка новой страницы путем передачи необходимой информации в качестве параметра // параметр rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Обеспечение активности текущего окна Window.Current.Activate(); } }