个人资料

跳过导航链接首页 > 博客列表 > 博客正文

UWP画中画将App置顶在最前端显示

分类:

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");

}

}





}


admin
最初发表2019/1/20 14:19:50 最近更新2019/5/8 23:15:10 3645
为此篇作品打分
10
   评论