Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ListPickerFlyout ignores RequestedTheme of parent page in Windows Phone 8.1

I have a Page in a WinRT Windows Phone 8.1 application. This Page has RequestedTheme set to ElementTheme.Light. The system theme (as set in system settings) is set to dark.

When I open a ListPickerFlyout (using Button.Flyout), the result is the following:

enter image description here

It seems, that the foreground color appropriately changes to black, but the background stays dark-themed (a very dark gray).

There isn't a Background property on the flyout, is there a way to force it to comply with the Page's RequestedTheme?

like image 583
Jan Kratochvil Avatar asked May 31 '14 16:05

Jan Kratochvil


2 Answers

Great question!

In the application resources, you can override a resource called FlyoutBackgroundThemeBrush for Light themes.

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Light">
                <SolidColorBrush x:Key="FlyoutBackgroundThemeBrush" Color="Green" />
            </ResourceDictionary>
        </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>
</Application.Resources>

This will make it green for proof of concept. :)

like image 189
Igor Ralic Avatar answered Dec 15 '22 19:12

Igor Ralic


The problem is that flyouts do not use the Page's RequestedTheme, but App's RequestedTheme.

In this case, the solution is to set Application.Current.RequestedTheme = ApplicationTheme.Light in addition to setting Page.RequestedTheme = ElementTheme.Light.

like image 21
Jan Kratochvil Avatar answered Dec 15 '22 19:12

Jan Kratochvil