Search code examples
.netmauimaui-windowsmaui-community-toolkit

How to change DropDown background color of picker in the .NetMaui


By default, dropdown background color of picker in .Netmaui seem to be set as Gray200; Please tell me how to change it by customized color.

I already set this:

<Picker.Resources> <SolidColorBrush x:Key="TransparentBrush" Color="#464E51"/> <!--<SolidColorBrush x:Key="TransparentBrush" Color="Transparent"/>--> </Picker.Resources>

but it's fail to change background color of the dropdown


Solution

  • You could add some code in the Project/Platforms/Windows/App.xaml file:

    <maui:MauiWinUIApplication
        ...
        xmlns:local="using:MauiApp11.WinUI">
        <!--Add the following three lines-->
        <maui:MauiWinUIApplication.Resources>
            <SolidColorBrush x:Key="ComboBoxDropDownBackground" Color="#464E51" />
        </maui:MauiWinUIApplication.Resources>
    </maui:MauiWinUIApplication>
    

    Hope it works for you.