Hello,
There is a known issue reported at GitHub- Android: ListView Item selected color is by default Orange and no property available to change this color #13812, please follow the progress.
And there is a workaround for iOS and Android at GitHub, you have to customize the ViewCell with Microsoft.Maui.Controls.Handlers.Compatibility.ViewCellRenderer
, then overwrite the iOS and Android native methods to set the background color for the cell.
Please refer to Customizing a ViewCell - Xamarin | Microsoft Learn
and Reuse custom renderers in .NET MAUI - .NET MAUI | Microsoft Learn
In addition, it's recommended that you try to use CollectionView instead of ListView
, and change selected item color.
Update
Windows platform is based on WinUI, you could try to open App.xaml
under Platforms/Windows folder, then modify the default resource.
<maui:MauiWinUIApplication ......>
<maui:MauiWinUIApplication.Resources>
<ResourceDictionary>
<SolidColorBrush x:Key="ListViewItemBackgroundSelected" Color="#Ff0000" />
<SolidColorBrush x:Key="ListViewItemBackgroundSelectedPointerOver" Color="#Ff0000" />
<SolidColorBrush x:Key="ListViewItemBackgroundSelectedPressed" Color="#Ff0000" />
<SolidColorBrush x:Key="ListViewItemSelectedBackgroundThemeBrush" Color="#Ff0000" />
</ResourceDictionary>
</maui:MauiWinUIApplication.Resources>
</maui:MauiWinUIApplication>
For more styles, you can see the WinUI source code: ListViewItem_themeresources.xaml
Best Regards,
Wenyan Zhang
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.