IList<AppDiagnosticInfo> infos = await AppDiagnosticInfo.RequestInfoForAppAsync(); IList<AppResourceGroupInfo> resourceInfos = infos[0].GetResourceGroups(); await resourceInfos[0].StartSuspendAsync();对于1809以下SDK版本,即使最小化自己的app也需要declare the 'appDiagnostics' capability in your manifest
ms-settings:privacy-appdiagnostics
1809及以上版本不需要,但如果最小化其他app仍需要此功能声明.
参考:https://stackoverflow.com/questions/50020408/minimize-uwp-programatically
====
最大化:
var view = ApplicationView.GetForCurrentView(); if (mediaElement.IsFullWindow) { view.TryEnterFullScreenMode(); } else { view.ExitFullScreenMode(); }