问题
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