[英]App Bar becomes hidden when navigating away from a page, with its background the phone's theme (and not what is defined in app)
When I'm navigating between pages on my WP8 app, I noticed as part of the transition animation (using Telerik's ie "RootFrame = new Telerik.Windows.Controls.RadPhoneApplicationFrame();"), the App Bar on the page navigated from becomes hidden first. 当我在WP8应用程序的页面之间导航时,我注意到作为过渡动画的一部分(使用Telerik的即“ RootFrame = new Telerik.Windows.Controls.RadPhoneApplicationFrame();”),页面上的应用栏从首先隐藏。 It's sudden and for a very short amount of time, but is still noticeable.
这是很短的时间,但是仍然很明显。
Here is the app bar of the page: 这是页面的应用栏:
And here is the app bar of the same page when I hit back ie navigating away from it. 这是我回击即离开该页面时同一页面的应用程序栏。 Where the app bar was showing previously, there's a white background showing instead.
应用栏之前显示过的地方是白色背景。 Of course, as I said, this is for a split moment, because before you know it, you're taken back to the last page.
当然,正如我所说的,这只是片刻,因为在不知道它之前,您将回到最后一页。 But it's still noticeable.
但这仍然很明显。
The white background appears to be that of the phone's theme (its theme is Light), even though I've reset the RootFrame's background to black in App.xaml.cs, and also reset all brushes to use the Dark theme's (advice from Windows phone 8 How to be always on one theme even if phone's theme changed ): 白色的背景似乎是手机的主题(主题是光),即使我在App.xaml.cs重置RootFrame的背景为黑色,并重置所有刷子使用深色主题的(从建议的Windows phone 8即使手机的主题已更改,如何始终保持一个主题 ):
public App()
{
// code here
RootFrame.Background = new SolidColorBrush(Colors.Black);
DarkTheme();
}
public void DarkTheme()
{
((SolidColorBrush)Resources["PhoneRadioCheckBoxCheckBrush"]).Color = ((SolidColorBrush)Resources["PhoneRadioCheckBoxBorderBrush"]).Color = ((SolidColorBrush)Resources["PhoneForegroundBrush"]).Color = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneBackgroundBrush"]).Color = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
((SolidColorBrush)Resources["PhoneContrastForegroundBrush"]).Color = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
((SolidColorBrush)Resources["PhoneContrastBackgroundBrush"]).Color = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneDisabledBrush"]).Color = Color.FromArgb(0x66, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneProgressBarBackgroundBrush"]).Color = Color.FromArgb(0x19, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneTextCaretBrush"]).Color = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
((SolidColorBrush)Resources["PhoneTextBoxBrush"]).Color = Color.FromArgb(0xBF, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneTextBoxForegroundBrush"]).Color = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
((SolidColorBrush)Resources["PhoneTextBoxEditBackgroundBrush"]).Color = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneTextBoxReadOnlyBrush"]).Color = Color.FromArgb(0x77, 0x00, 0x00, 0x00);
((SolidColorBrush)Resources["PhoneSubtleBrush"]).Color = Color.FromArgb(0x99, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneTextBoxSelectionForegroundBrush"]).Color = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneButtonBasePressedForegroundBrush"]).Color = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneTextHighContrastBrush"]).Color = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneTextMidContrastBrush"]).Color = Color.FromArgb(0x99, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneTextLowContrastBrush"]).Color = Color.FromArgb(0x73, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneSemitransparentBrush"]).Color = Color.FromArgb(0xAA, 0x00, 0x00, 0x00);
((SolidColorBrush)Resources["PhoneChromeBrush"]).Color = Color.FromArgb(0xFF, 0x1F, 0x1F, 0x1F);
((SolidColorBrush)Resources["PhoneInactiveBrush"]).Color = Color.FromArgb(0x33, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneInverseInactiveBrush"]).Color = Color.FromArgb(0xFF, 0xCC, 0xCC, 0xCC);
((SolidColorBrush)Resources["PhoneInverseBackgroundBrush"]).Color = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF);
((SolidColorBrush)Resources["PhoneBorderBrush"]).Color = Color.FromArgb(0xBF, 0xFF, 0xFF, 0xFF);
}
The custom set RootFrame background and reset brushes in DarkTheme() seem to be working for the most part. DarkTheme()中的自定义设置RootFrame背景和重置笔刷似乎在大多数情况下都起作用。 It's only when transitioning from a non-default page (ie not the page the app lands on) with an app bar back to another page, that this problem seems to arise.
仅当从带有应用程序栏的非默认页面(即不是应用程序所到达的页面)过渡到另一个页面时,才会出现此问题。
Any ideas what's going on? 有什么想法吗?
Okay the solution is to set the app bar's opacity to 0.9999 and the page's footer to -100. 好的解决方法是将应用程序栏的不透明度设置为0.9999,并将页面的页脚设置为-100。 Bit dirty, but works!
有点脏,但可以!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.