How keep a UWP AppWindow fullscreen when another AppWindow enters Fullscreen on 2nd monitor?

孤人 提交于 2021-02-10 06:24:29

问题


I'm trying to open 2 AppWindows (appWindowOne & appWindowTwo) on separate monitors in full screen but when appWindowTwo opens appWindowOne minimizes. I've tried making the AppWindow re-enter full screen programmatically but it causes the other AppWindow to minimize. When manually clicked in the taskbar it restores to full screen without affecting the other but I would like to know if it's possible to do it programmatically?

public static async void ShowAppWindows()
{
    AppWindow appWindowOne = await AppWindow.TryCreateAsync();
    Frame frameOne = new Frame();
    ElementCompositionPreview.SetAppWindowContent(appWindowOne, frameOne);

    AppWindow appWindowTwo = await AppWindow.TryCreateAsync();
    Frame frameTwo = new Frame();
    ElementCompositionPreview.SetAppWindowContent(appWindowTwo, frameTwo);

    FullScreenPresentationConfiguration FSPC = new FullScreenPresentationConfiguration()
    {
         IsExclusive = false
    };

    await appWindowOne.TryShowAsync();
    appWindowOne.RequestMoveToDisplayRegion(displayRegions[0]);
    appWindowOne.Presenter.RequestPresentation(FSPC);

    await appWindowTwo.TryShowAsync();
    appWindowTwo.RequestMoveToDisplayRegion(displayRegions[1]);
    appWindowTwo.Presenter.RequestPresentation(FSPC);
}

回答1:


. I've tried making the AppWindow re-enter full screen programmatically but it causes the other AppWindow to minimize.

This looks UI-thread was broken when make appWindowTwo into full screen. I guess setting two windows in a row in full screen will exhaust the UI thread. So, we could try to call a Task.Delay() before making appWindowTwo into full screen.



来源:https://stackoverflow.com/questions/61603569/how-keep-a-uwp-appwindow-fullscreen-when-another-appwindow-enters-fullscreen-on

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!