Raghav Manikandan
Raghav Manikandan

Reputation: 679

How to change the application bar background color dynamically for wp7

I have created an application bar through codes(in xaml.cs), but if i tried to change the background color of the app bar, it throws an error. I think the below codes is not correct for an app bar.

ApplicationBar.BackgroundColor = new SolidColorBrush(Colors.Black);

Can anybody help me with this? Thanks for your help!

Upvotes: 0

Views: 3460

Answers (1)

decyclone
decyclone

Reputation: 30830

The BackgroundColor property type is Color and not Brush:

public Color BackgroundColor { get; set; }

So, following should work:

ApplicationBar.BackgroundColor = Colors.Black; 

PS. Most of the times, reading compile time error messages can give you a lot of clarity.

Upvotes: 9

Related Questions