From 7a40261254986cc767cd5b4a7a70f5e395a2d750 Mon Sep 17 00:00:00 2001 From: Tung Huynh Date: Sun, 14 Jan 2024 18:35:53 -0800 Subject: [PATCH 1/3] default fullscreen layout for player page on xbox --- Screenbox/Pages/PlayerPage.xaml.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Screenbox/Pages/PlayerPage.xaml.cs b/Screenbox/Pages/PlayerPage.xaml.cs index c4455c857..f851c315e 100644 --- a/Screenbox/Pages/PlayerPage.xaml.cs +++ b/Screenbox/Pages/PlayerPage.xaml.cs @@ -5,6 +5,7 @@ using CommunityToolkit.WinUI; using Screenbox.Controls; using Screenbox.Core.Enums; +using Screenbox.Core.Helpers; using Screenbox.Core.ViewModels; using System; using System.ComponentModel; @@ -204,6 +205,10 @@ private void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs PlayerControls.FocusFirstButton(); } + break; + case nameof(PlayerPageViewModel.ViewMode) when SystemInformation.IsXbox: + // Xbox always defaults to fullscreen layout + VisualStateManager.GoToState(this, "Fullscreen", false); break; case nameof(PlayerPageViewModel.ViewMode): switch (ViewModel.ViewMode) @@ -235,7 +240,7 @@ private void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs { case PlayerVisibilityState.Visible: VisualStateManager.GoToState(this, "NoPreview", true); - VisualStateManager.GoToState(this, "Normal", true); + VisualStateManager.GoToState(this, SystemInformation.IsXbox ? "Fullscreen" : "Normal", true); SetTitleBar(); break; case PlayerVisibilityState.Minimal: From 0f815e1f8f41b0342cf9970a0f4759e36b3632c4 Mon Sep 17 00:00:00 2001 From: Tung Huynh Date: Sun, 14 Jan 2024 23:49:56 -0800 Subject: [PATCH 2/3] fix light dismiss layer not on top of overlay content --- Screenbox/Controls/CustomNavigationView.cs | 16 +++++++++++----- Screenbox/Controls/Styles/CustomSplitView.xaml | 14 ++++++++------ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Screenbox/Controls/CustomNavigationView.cs b/Screenbox/Controls/CustomNavigationView.cs index 18989d4a6..89b52e78f 100644 --- a/Screenbox/Controls/CustomNavigationView.cs +++ b/Screenbox/Controls/CustomNavigationView.cs @@ -71,7 +71,8 @@ public UIElement? OverlayContent set => SetValue(OverlayContentProperty, value); } - private Border? _overlayRoot; + private Grid? _overlayRoot; + private Border? _overlayContentHost; private Border? _contentBackground; private SplitView? _splitView; private Grid? _paneToggleButtonGrid; @@ -124,12 +125,17 @@ protected override void OnKeyDown(KeyRoutedEventArgs e) private void OnLoaded(object sender, RoutedEventArgs e) { - if (_splitView?.FindDescendant(b => b.Name == "OverlayRoot") is { } overlayRoot) + if (_splitView?.FindDescendant(b => b.Name == "OverlayRoot") is { } overlayRoot) { _overlayRoot = overlayRoot; overlayRoot.Tapped += OverlayRootOnTapped; - overlayRoot.Child = OverlayContent; Canvas.SetZIndex(overlayRoot, OverlayZIndex); + + if (overlayRoot.FindDescendant(b => b.Name == "OverlayContentHost") is { } overlayContentHost) + { + _overlayContentHost = overlayContentHost; + overlayContentHost.Child = OverlayContent; + } } if (_splitView?.FindDescendant(b => b.Name == "ContentBackground") is { } contentBackground) @@ -180,9 +186,9 @@ private static void OnContentVisibilityChanged(DependencyObject d, DependencyPro private static void OnOverlayContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { CustomNavigationView view = (CustomNavigationView)d; - if (view._overlayRoot != null) + if (view._overlayContentHost != null) { - view._overlayRoot.Child = (UIElement)e.NewValue; + view._overlayContentHost.Child = (UIElement)e.NewValue; } } diff --git a/Screenbox/Controls/Styles/CustomSplitView.xaml b/Screenbox/Controls/Styles/CustomSplitView.xaml index 0dbcfa8c1..4d0e21a25 100644 --- a/Screenbox/Controls/Styles/CustomSplitView.xaml +++ b/Screenbox/Controls/Styles/CustomSplitView.xaml @@ -78,18 +78,20 @@ Background="{ThemeResource SplitViewContentBackground}" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" /> - - + Grid.ColumnSpan="2"> + + + From c47ce064d738fa5e27aba87331409017d10cf2d1 Mon Sep 17 00:00:00 2001 From: Tung Huynh Date: Sat, 27 Jan 2024 00:15:22 -0800 Subject: [PATCH 3/3] wip xbox main page layout --- Screenbox/Controls/CustomNavigationView.cs | 6 ------ Screenbox/Pages/MainPage.xaml | 9 +++++++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Screenbox/Controls/CustomNavigationView.cs b/Screenbox/Controls/CustomNavigationView.cs index 89b52e78f..e9aee0b88 100644 --- a/Screenbox/Controls/CustomNavigationView.cs +++ b/Screenbox/Controls/CustomNavigationView.cs @@ -3,7 +3,6 @@ using CommunityToolkit.WinUI; using CommunityToolkit.WinUI.Animations; using System; -using System.Numerics; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; @@ -91,11 +90,6 @@ protected override void OnApplyTemplate() _paneToggleButtonGrid = (Grid?)GetTemplateChild("PaneToggleButtonGrid"); _contentGrid = (Grid?)GetTemplateChild("ContentGrid"); _paneContentGrid = (Grid?)GetTemplateChild("PaneContentGrid"); - Grid? shadowCaster = (Grid?)GetTemplateChild("ShadowCaster"); - if (shadowCaster != null) - { - shadowCaster.Translation = new Vector3(0, 0, 32); - } if (_splitView != null) { diff --git a/Screenbox/Pages/MainPage.xaml b/Screenbox/Pages/MainPage.xaml index daad9d2bd..2e7647430 100644 --- a/Screenbox/Pages/MainPage.xaml +++ b/Screenbox/Pages/MainPage.xaml @@ -21,8 +21,9 @@ - 0,48,0,0 + 0,34,0,0 0,48,0,0 + 16,30,16,30 0,0,0,0 0,0,0,0 0,0,0,0 @@ -52,7 +53,8 @@ x:Name="AppTitleBar" Height="48" VerticalAlignment="Top" - Canvas.ZIndex="1"> + Canvas.ZIndex="1" + Visibility="Collapsed">