Rudi
Rudi

Reputation: 936

Bind SystemTray.BackgroundColor

I'm trying to change the SystemTray.BackgroundColor of my Windows Phone Application by binding it to a property in my ViewModel. I've a property, which sets the Background of my Application.

    private SolidColorBrush _bgcolor;
    public SolidColorBrush BGColor
    {
        get
        {
            return _bgcolor;
        }
        set
        {
            _bgcolor = value;
            RaisePropertyChanged(() => BGColor);
        }
    }

Now I want to set the BackgroundColor of the SystemTray to the same color as the BGColor. BGColor can be changed all the time & that's why I also want to change the SystemTray.BackgroundColor. Anyway, I've tried to Bind the SystemTray in like this:

shell:SystemTray.BackgroundColor="{Binding BGColor}"

Still, SystemTray Color is black. DataContext is set via a Locator

DataContext="{Binding Main, Source={StaticResource Locator}}"

Upvotes: 0

Views: 86

Answers (1)

lisp
lisp

Reputation: 4198

The Binding works, but the SystemTray.BackgroundColor is an Attached Property of type System.Windows.Media.Color.

So this will work:

public Color BGColor { get { return Colors.Orange; } }

Upvotes: 1

Related Questions