我以这种方式在 App.xaml.cs 中创建了一个 Global AppBar:
public static AppBar _globalAppBar = new AppBar();
public App()
{
//Code
SetUpBar();
}
public void SetUpBar()
{
//SIZE
_globalAppBar.Height = 250;
//BACKGROUND
ImageBrush bck = new ImageBrush();
bck.ImageBrush = new BitmapImage(new Uri("Path"));
_globalAppBar.Background = bck;
}
我这样做是因为我希望这个页面出现在应用程序的每个页面中,并且Microsoft给出的代码对我不起作用,所以我决定像WP 8那样做(实际上是在我的情况下,我使用的是 C# 而不是 XAML)。
所以,我面临的问题是 appbar 采用照片的大小,我没有找到任何属性来设置 ImageBrush 的高度。
我想设置 appbar 的布局并在项目中的所有页面上共享它(避免在每个页面中复制和粘贴代码),因此任何示例或帮助将不胜感激:)。提前致谢!