且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Windows Phone 8.1 中创建透明命令栏

更新时间:2022-04-27 23:17:48

在 App.xaml.cs, OnLaunched Method, Window.Current.Activate() 之前使用此代码;

Use this code in App.xaml.cs, OnLaunched Method, before Window.Current.Activate();

Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SetDesiredBoundsMode(
ApplicationViewBoundsMode.UseCoreWindow);

默认情况下,框架仅在可见区域内布局窗口内容.因此,当您展开 appbar 时,即使您将 appbar 设置为透明,它也会显示其背后的底色(黑色/白色).所以如果你想使用整个页面窗口,你必须使用上面的代码,它在整个应用程序中设置核心窗口.

EDIT : Bydefault, the framework layouts the window's content within the visible region only. Hence, when you expanded the appbar, it shows the basecolor(black/white) behind it eventhough you set the appbar transparent. So if you want to make use of entire page window, you have to use the above code, which sets core window across the entire app.