在我的应用中,我希望应用栏的颜色为白色且完全不透明,不考虑主题。到目前为止,我已经对此进行了实验。
ApplicationBar.Opacity = 1;
ApplicationBar.BackgroundColor = Color.FromArgb(52, 50, 2, 181);
结果是浅粉色,有一些透明度。此外,即使主题很暗,我也希望保持相同的主题彩色(浅色主题)图标按钮。我见过WP Store(主要是Skype)中的应用程序。答案很高兴。
答案 0 :(得分:3)
两种方式,在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(完全不透明)。