I checked the Application bar but no style attribute is shown. I have about 10 pages that use an app bar so it would be ideal to set a style in the Application.Resources. Is it possible to apply a style to all application bars in my application?
Asked
Active
Viewed 1,266 times
2 Answers
2
You can pretty much do this with a abstract class which your pages inherit from.
public abstract class BasePage : PhoneApplicationPage
{
public abstract bool UsingApplicationBar { get; }
public Color ApplicationBarColor= Colors.Gray;
public BasePage()
{
Loaded += BasePageLoaded;
}
private void BasePageLoaded(object sender, RoutedEventArgs e)
{
if (UsingApplicationBar)
{
ApplicationBar.BackgroundColor = ApplicationBarColor;
}
}
}

William Melani
- 4,270
- 1
- 21
- 44
1
As far as I understand your question, you have different application bars on different pages and you want to have a style which can be applied to all. Unfortunately, binding does not work with application bars. You may have to style all of them one by one. For more information: Windows Phone ApplicationBar BackgroundColor property style XamlParseException
-
Ok I see. I hope that changes in the future. Thanks for the quick response. I'll check your answer as accepted as soon as it lets me. – Edward Jan 12 '12 at 14:30