Uwp总在最前端显示Application
private async void AlwaysTop_Click(object sender, RoutedEventArgs e) { if (IsAlwayStop) { bool modeSwitched = await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.Default); IsAlwayStop = false; } else { if (ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay)) { IsAlwayStop = true; Debug.WriteLine("支持画中画"); bool modeSwitched0 = await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay); ViewModePreferences compactOptions = ViewModePreferences.CreateDefault(ApplicationViewMode.CompactOverlay); compactOptions.CustomSize = new Windows.Foundation.Size(800, 800);//你要的窗口大小 bool modeSwitched = await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay, compactOptions); if (modeSwitched) { Debug.WriteLine("启动画中画成功"); } } else { ToastMessage.Toast("Sorry,CompactOverlay ViewMode Is not Support in Current System Environment"); } } }