![](/img/trans.png)
[英]How properly handle change mode of application bar in windows phone 7
[英]How to change color of the Application Bar in Windows Phone?
在我的应用程序中,我希望应用程序栏的颜色为白色且完全不透明,而不考虑主题。 到目前为止,我已经尝试过这个。
ApplicationBar.Opacity = 1;
ApplicationBar.BackgroundColor = Color.FromArgb(52, 50, 2, 181);
结果是浅粉红色,有一些透明度。 此外,即使主题很暗,我也希望保持相同的主题彩色(浅色主题)图标按钮。 我见过WP Store(主要是Skype)中的应用程序。 答案很高兴欣赏。
两种方式,在XAML中:
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar BackgroundColor="White" ForegroundColor="Black">
<shell:ApplicationBar.Buttons>
<shell:ApplicationBarIconButton Text="A button" IconUri="/Assets/AppBar/new.png" />
</shell:ApplicationBar.Buttons>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
或者在后面的代码中:
using System.Windows.Media;
...
ApplicationBar.ForegroundColor = Colors.Black; // Icon and text color
ApplicationBar.BackgroundColor = Colors.White; // Application bar background color
基本上, BackgroundColor
设置应用程序栏的背景颜色, ForegroundColor
设置图标和文本颜色。 无论主题设置如何,设置它们都将保留该值。
您不需要设置opacity
,因为默认值为1(完全不透明)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.