想了一下哪些项目可以成为页面的父项之后,我将注意力转向了Frame。
这可以通过设置帧的BackgroundColor
属性,在创建时,在OnLaunched
方法(App.xaml.cs):
protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame
{
CacheSize = 1,
Background = new SolidColorBrush(Colors.White)
};
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
// TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
... //rest of OnLaunched method
}
Also you have to make sure to set the background of the Frame as well in the OnActivated
方法来解决,因为这会在某些情况下,如其他应用推出URI到您的应用程序或柯塔娜发布会推出应用程序等。