Skip to content

Suggestion: Add Minimize method to FullScreenPresenter #6355

@benstevens48

Description

@benstevens48

Currently there is no way to directly minimize a fullscreen window (without using Win32 APIs). One has to change to an OverlappedPresenter first, but then when the window is restored it is no longer fullscreen. It ought to be possible to minimize the window directly. I suggest the Minimize() and Minimize(bool activateWindow) methods should be copied from OverlappedPresenter to FullScreenPresenter (and probably to CompactOverlayPresenter as well although I haven't used that).

As an example of an app that implements this behavior, see the built-in Photos app.

The workaround code is not difficult (see below), but it would be good to avoid having to use Dll imports.

        public static bool MinimizeWindow(Window window, bool activate = false) {
            if (window == null) {
                return false;
            }
            var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(window);
            return ShowWindow(hwnd, activate ? SW_SHOWMINIMIZED : SW_SHOWMINNOACTIVE);
        }

        /* Win32 imports */

        private const int SW_SHOWMINIMIZED = 2;
        private const int SW_SHOWMINNOACTIVE = 7;
        [LibraryImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.I4)]
        private static partial bool ShowWindow(IntPtr hwnd, int nCmdShow);

        /* */

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-WindowingTopics related to the Windowing API in Windows App SDK, including AppWindow, presenters, etc.feature proposalneeds-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions