Picker used in Popup not inheriting color brushes

Jorge Nuricumbo 60 Reputation points
2024-01-02T17:56:52.34+00:00

Hello,

I'm styling my Pickers as described in one comment here:

https://github.com/dotnet/maui/issues/13418

    <maui:MauiWinUIApplication.Resources>
        <SolidColorBrush x:Key="ComboBoxItemForegroundPointerOver" Color="#00FF00" /> 
        <SolidColorBrush x:Key="ComboBoxDropDownBackground" Color="#444444" />
        <SolidColorBrush x:Key="ComboBoxItemForeground" Color="#FFFFFF" />
        <SolidColorBrush x:Key="ComboBoxForegroundPointerOver" Color="#FFFFFF" />
        <SolidColorBrush x:Key="ComboBoxItemForegroundSelected" Color="#FFFFFF" />
        <SolidColorBrush x:Key="ComboBoxItemForegroundSelectedPointerOver" Color="#00FF00" />
        <SolidColorBrush x:Key="ComboBoxItemForegroundPressed" Color="#FF00FF" />
        <SolidColorBrush x:Key="ComboBoxForegroundPressed" Color="#FFFFFF" />
        <SolidColorBrush x:Key="ComboBoxItemForegroundSelectedPressed" Color="#00FF00" />
        <SolidColorBrush x:Key="ComboBoxItemBackgroundSelected" Color="#777777" />
        <SolidColorBrush x:Key="ComboBoxItemBackgroundSelectedPointerOver" Color="#777777" />
        <SolidColorBrush x:Key="ComboBoxItemBackgroundSelectedPressed" Color="#777777" />
    </maui:MauiWinUIApplication.Resources>

This approach correctly styles my pickers when used in a ContentPage. However, if I use a picker in a toolkit:Popup, it does not style the picker correctly. I tried setting the color brushes directly to the popup resources, but it did not work. The described behavior can be reproduced with this repository:

https://github.com/nuxosio/maui-pickers-popup

If you check in my reproduction repository, you will see a picker in the MainPage with a green color while hovering. If you open the popup, the same picker is there, but the green color is not seen anymore.

I hope someone can give me some ideas for solving this issue.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,890 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
765 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 35,576 Reputation points Microsoft Vendor
    2024-01-03T06:38:04.6633333+00:00

    Hello,

    Thanks for your feedback.

    ToolKit:Popup corresponds to the Microsoft.UI.Xaml.Controls.Primitives.Popup control in WinUI3, and after testing, this issue does not occur in WinUI3 native Popup. Therefore, this issue should be specific to ToolKit:Pupop.

    For this issue, it is recommended that you report it to the official Toolkit repository to make the development team aware of it.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful