In my app, I want to have the color of the application bar be white and full opaque, with no regards to the theme. So far I have experimented with this.
ApplicationBar.Opacity = 1;
ApplicationBar.BackgroundColor = Color.FromArgb(52, 50, 2, 181);
The result was a light pink color with some transparency. Also, I would like to keep the same theme colored (light theme) icon buttons even if the theme is dark. I have seen apps in the WP Store (mainly Skype) that do that. Answers gladly appreciated.
Two ways, either in the 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>
Or in the code behind:
using System.Windows.Media;
...
ApplicationBar.ForegroundColor = Colors.Black; // Icon and text color
ApplicationBar.BackgroundColor = Colors.White; // Application bar background color
Essentially the BackgroundColor
sets the background color of the application bar and ForegroundColor
sets the icon and text color. Setting those will keep the value regardless of theme settings.
You don't need to set the opacity
, as the default value is 1 (full opaque).