ListPickerFlyout ignores RequestedTheme of parent page in Windows Phone 8.1

落爺英雄遲暮 提交于 2020-01-14 08:48:30

问题


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:

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?


回答1:


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. :)




回答2:


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.



来源:https://stackoverflow.com/questions/23973087/listpickerflyout-ignores-requestedtheme-of-parent-page-in-windows-phone-8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!