Hello,
You can do this by creating a custom style and setting it to the android:datePickerDialogTheme.
Firstly, create a xml file called style.xml in Platforms\Android\Resources\values\ folder.
Then create a style called MyTheme that extend the Maui.MainTheme and create a style for DatePickerDialog set the top color to other colors.
<?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">#ff00ff</item>
</style>
</resources>
If you want to change color of the selected item and Cancel and Ok button, you need to add following items in theCustomDatePickerDialog style.
<item name="colorPrimary">#ff00ff</item>
<item name="colorPrimaryDark">#ff00ff</item>
Next, you need to open the MainAcitivity.cs, set value of Theme to "@style/MyTheme". You need to hide the Actionbar in the Oncreate method as well, if not, you will get two navigationbars.
[Activity(Theme = "@style/MyTheme".....)]
public class MainActivity : MauiAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SupportActionBar.Hide();
}
}
Best Regards,
Leon Lu
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.