Fullscreen Window Management#
Screenbox's fullscreen mode is managed through a thin layer over the UWP ApplicationView API. The WindowService calls ApplicationView.TryEnterFullScreenMode() to enter fullscreen and ApplicationView.ExitFullScreenMode() to leave it. Both methods update the shared WindowContext.ViewMode property, which broadcasts a PropertyChangedMessage<WindowViewMode> via the MVVM Messenger so all view models stay synchronized without direct service dependencies .
A Window.SizeChanged listener in WindowService acts as a fallback: if the OS exits fullscreen externally (e.g., the user clicks the system title bar), it detects that ApplicationView.IsFullScreenMode is now false and resets ViewMode to Default .
UI State Machine#
PlayerPage drives visual layout through VisualStateManager. When ViewMode changes to FullScreen, ViewModelOnPropertyChanged calls GoToState(this, "Fullscreen", true) , which applies the Fullscreen visual state defined in PlayerPage.xaml — widening padding, increasing title bar height, and repositioning controls . The reverse transition (Fullscreen → Normal) animates elements back to their default positions .
Fullscreen can be toggled by:
- Double-tap on the video surface →
ToggleFullscreenCommand - Escape key →
GoBack()→WindowService.ExitFullScreen() - Player controls button →
ToggleFullscreenCommandinPlayerControlsViewModel
Window Activation State#
PlayerPage.xaml includes a WindowActivationGroup that uses the custom WindowActivationModeTrigger to apply a Deactivated visual state when the window loses focus — dimming title bar text and buttons . The TitleBar control independently listens to Window.Activated and transitions between Activated/Deactivated visual states for caption button styling .
WindowActivationModeTrigger reads CoreWindow.ActivationMode and re-evaluates the trigger on every CoreWindow.Activated event . It uses a weak event listener to avoid memory leaks .
Known Issue: Fullscreen Window Disappears on Multi-Monitor Focus Change#
On multi-monitor setups, clicking a window on a secondary monitor while Screenbox is fullscreen on the primary monitor causes the fullscreen player to disappear (issue #1102). This is a consequence of UWP fullscreen behavior: the platform exits fullscreen mode when the CoreWindow transitions to Deactivated, and WindowService.OnWindowSizeChanged then resets ViewMode to Default .
There is currently no workaround in the codebase — no "always on top" mode or multi-monitor fullscreen exemption is implemented. The user-requested workaround of an "always on top" mode (via CompactOverlay/ApplicationViewMode.CompactOverlay) exists as a separate feature but does not currently restore fullscreen after focus loss.
Multi-Monitor Display Region Handling#
For window sizing (not fullscreen), WindowService.GetMaxWindowSize uses ApplicationView.GetDisplayRegions()[0] to read the active monitor's work area on Windows 10 (API contract 8+), so window-resize operations respect per-monitor DPI and work area .
Key Files#
| File | Role |
|---|---|
Screenbox.Core/Services/WindowService.cs | Fullscreen enter/exit, cursor hide, window resize |
Screenbox/Pages/PlayerPage.xaml.cs | Maps ViewMode changes to visual states |
Screenbox/Pages/PlayerPage.xaml | Fullscreen, Normal, WindowActivationGroup visual states |
Screenbox/Triggers/WindowActivationModeTrigger.cs | Declarative trigger for CoreWindow.ActivationMode |
Screenbox.UI/Controls/TitleBar/TitleBar.cs | Title bar activation state, drag region, caption colors |