Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Screenbox/Controls/CustomNavigationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -71,7 +70,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;
Expand All @@ -90,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)
{
Expand Down Expand Up @@ -124,12 +119,17 @@ protected override void OnKeyDown(KeyRoutedEventArgs e)

private void OnLoaded(object sender, RoutedEventArgs e)
{
if (_splitView?.FindDescendant<Border>(b => b.Name == "OverlayRoot") is { } overlayRoot)
if (_splitView?.FindDescendant<Grid>(b => b.Name == "OverlayRoot") is { } overlayRoot)
{
_overlayRoot = overlayRoot;
overlayRoot.Tapped += OverlayRootOnTapped;
overlayRoot.Child = OverlayContent;
Canvas.SetZIndex(overlayRoot, OverlayZIndex);

if (overlayRoot.FindDescendant<Border>(b => b.Name == "OverlayContentHost") is { } overlayContentHost)
{
_overlayContentHost = overlayContentHost;
overlayContentHost.Child = OverlayContent;
}
}

if (_splitView?.FindDescendant<Border>(b => b.Name == "ContentBackground") is { } contentBackground)
Expand Down Expand Up @@ -180,9 +180,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;
}
}

Expand Down
14 changes: 8 additions & 6 deletions Screenbox/Controls/Styles/CustomSplitView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,20 @@
Background="{ThemeResource SplitViewContentBackground}"
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" />
<Border Child="{TemplateBinding Content}" />
<Rectangle
x:Name="LightDismissLayer"
Fill="Transparent"
Visibility="Collapsed" />

</Grid>

<!-- Overlay Area -->
<Border
<Grid
x:Name="OverlayRoot"
Grid.Column="0"
Grid.ColumnSpan="2" />
Grid.ColumnSpan="2">
<Border x:Name="OverlayContentHost" />
<Rectangle
x:Name="LightDismissLayer"
Fill="Transparent"
Visibility="Collapsed" />
</Grid>

<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DisplayModeStates">
Expand Down
9 changes: 7 additions & 2 deletions Screenbox/Pages/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
<ResourceDictionary Source="/Controls/Styles/CustomSplitView.xaml" />
</ResourceDictionary.MergedDictionaries>

<Thickness x:Key="NavigationViewContentMargin">0,48,0,0</Thickness>
<Thickness x:Key="NavigationViewContentMargin">0,34,0,0</Thickness>
<Thickness x:Key="NavigationViewMinimalContentMargin">0,48,0,0</Thickness>
<Thickness x:Key="NavigationViewPaneContentGridMargin">16,30,16,30</Thickness>
<Thickness x:Key="NavigationViewContentGridBorderThickness">0,0,0,0</Thickness>
<Thickness x:Key="NavigationViewMinimalContentGridBorderThickness">0,0,0,0</Thickness>
<CornerRadius x:Key="NavigationViewContentGridCornerRadius">0,0,0,0</CornerRadius>
Expand Down Expand Up @@ -52,7 +53,8 @@
x:Name="AppTitleBar"
Height="48"
VerticalAlignment="Top"
Canvas.ZIndex="1">
Canvas.ZIndex="1"
Visibility="Collapsed">
<!-- Width of the padding columns is set in LayoutMetricsChanged handler. -->
<!--
Using padding columns instead of Margin ensures that the background
Expand Down Expand Up @@ -115,9 +117,12 @@
DisplayModeChanged="NavView_OnDisplayModeChanged"
ExpandedModeThresholdWidth="1058"
IsPaneOpen="{x:Bind ViewModel.IsPaneOpen, Mode=TwoWay}"
IsPaneToggleButtonVisible="False"
IsSettingsVisible="False"
IsTitleBarAutoPaddingEnabled="False"
OpenPaneLength="240"
PaneClosing="NavView_OnPaneClosing"
PaneDisplayMode="Left"
PaneOpening="NavView_OnPaneOpening"
SelectionChanged="NavView_SelectionChanged"
SplitViewStyle="{StaticResource CustomSplitViewStyle}">
Expand Down
7 changes: 6 additions & 1 deletion Screenbox/Pages/PlayerPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down