cimbalino / Cimbalino-Phone-Toolkit

Cimbalino Windows Phone Toolkit
MIT License
78 stars 32 forks source link

Appbar doesn't change when theme is selected within the app #39

Closed DVDPT closed 10 years ago

DVDPT commented 10 years ago

If you change the app theme in runtime (e.g using Jeff Wilcox thememanager) the appbar behavior don't change to the new theme. I Implemented the following on my apps if you want to add it ;)

public class ThemeAwareApplicationBarBehavior : ApplicationBarBehavior { public ThemeAwareApplicationBarBehavior() { }

    protected override void OnAttached()
    {
        base.OnAttached();
        BackgroundColor = ApplicationResources.Instance.GetResource<SolidColorBrush>("PhoneChromeBrush").Color;
        ForegroundColor = ApplicationResources.Instance.GetResource<SolidColorBrush>("PhoneForegroundBrush").Color;
    }
}
pedrolamas commented 10 years ago

True, but neither ApplicationBarBehavior nor Jeff's ThemeManager were built thinking in communicating between them! :)

Solution at this moment is just setting the ApplicationBarBehavior.BackgroundColor and ApplicationBarBehavior.ForegroundColor manually, like in the following example:

https://github.com/PedroLamas/GDrive/blob/master/PedroLamas.GDrive.WP7/View/NewFolderPage.xaml