0

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

Le Anh Xuan
  • 125
  • 7

1 Answers1

0

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.

Liqun Shen-MSFT
  • 3,490
  • 2
  • 3
  • 11
  • Yes, I's done. Thanks Shen. – Le Anh Xuan Nov 29 '22 at 07:28
  • Shen, please help me why event though I've set text color of Picker is White --> it still be Black when mouse move arround. – Le Anh Xuan Nov 29 '22 at 07:32
  • As far as i know, it's stiil a bug on Windows. You could follow this thread [Fix DatePicker TextColor property](https://github.com/dotnet/maui/pull/7995). – Liqun Shen-MSFT Nov 29 '22 at 08:54
  • Thanks Shen again for your quickly answer. And have others questions need your help: 1. As your suggestion, all of my pickers in projects have a same background for dropdown item --> then It's could not change when App became LightMode or DarkMode? 2.How to change text color in Dropdown Items? – Le Anh Xuan Nov 29 '22 at 09:37
  • Sorry @Le Anh Xuan, you should start a new thread for new question. We should adhere to Stack Overflow's rules. – Liqun Shen-MSFT Nov 29 '22 at 14:27
  • Hi @Liqun Shen, Instead of only set: Have anyways to set Color value depending on AppThemeBinding? – Le Anh Xuan Dec 19 '22 at 19:33