DatePicker buttons not change color

NickNN 40 Reputation points
2025-11-21T07:05:17.0666667+00:00

Hello,

I'm using a DatePicker in a .NET Maui app that I ported from Xamarin.Forms.

The DatePicker isn't displaying the 'accent' color for the 'accept' and 'cancel' buttons, and I can't seem to change the color because they're barely visible:

Screenshot 2025-11-21 at 07.55.40

I've tried using themes in the styles.xml file (Platform/Android/Resources/values) and custom handlers... but nothing has worked.

The only time I used a theme that worked, it added an extra navigation bar to my app.

Usé esto en el style.xaml:

<?xml version="1.0" encoding="utf-8" ?>
<resources>
	<style name="MyTheme" parent="Maui.MainTheme">
		<item name="android:datePickerDialogTheme">@style/CustomDatePickerDialog</item>
	</style>
	<style name="CustomDatePickerDialog" parent="ThemeOverlay.AppCompat.Dialog">
		<item name="colorAccent">#393939</item>
		<item name="colorPrimary">#393939</item>
		<item name="colorPrimaryDark">#393939</item>
	</style>
</resources>

Any ideas? Thanks.

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Harry Vo (WICLOUD CORPORATION) 3,385 Reputation points Microsoft External Staff Moderator
    2025-11-21T07:49:35.44+00:00

    Hi @NickNN ,

    In .NET MAUI, the DatePicker no longer uses the same theming model that Xamarin.Forms used. MAUI renders controls through handlers, not renderers, so Android theme values such as colorAccent or datePickerDialogTheme in styles.xml no longer apply to MAUI dialogs.

    Because of this, DatePicker dialogs typically ignore older AppCompat theme overrides, and this is why your OK/Cancel buttons do not change color.

    To style the DatePicker buttons in MAUI, you must override the platform dialog using a custom handler, where you can set the dialog's positive/negative button colors manually.

    I hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.