Xamarin.Forms DatePicker dialogue color customization

Mohammad Radawan 106 Reputation points
2021-07-25T09:43:05.513+00:00

I'm developing an app in Xamarin.Forms. I managed to change the accent color of the DatePicker calendar dialog, and now I'm able to apply this color to the "Header" area, but my question is: How can I change the body background color, and also how can I change the font color (numbers color)?
117643-datepickerdialog.png

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

Accepted answer
  1. Kyle Wang 5,531 Reputation points Microsoft External Staff
    2021-07-26T02:38:20.98+00:00

    Hi MohammadRadawan-7969,

    Welcome to our Microsoft Q&A platform!

    To modify the color of the data picker, you can try to modify the styles.xml as follows.

    <style name="MainTheme" parent="MainTheme.Base">  
     <item name="android:datePickerDialogTheme">@style/CustomDatePickerDialog</item>  
    </style>  
      
    <style name="CustomDatePickerDialog" parent="ThemeOverlay.AppCompat.Dialog">  
     <!--header background-->  
     <item name="colorAccent">#009933</item>  
     <!--header textcolor-->  
     <item name="android:textColorPrimaryInverse">#ff9900</item>  
     <!--body background-->  
     <item name="android:windowBackground">#000099</item>  
     <!--selected day-->  
     <item name="android:colorControlActivated">#ff8000</item>  
     <!--days of the month-->  
     <item name="android:textColorPrimary">#ffff00</item>  
     <!--days of the week-->  
     <item name="android:textColorSecondary">#ff0066</item>  
     <!--cancel&ok-->  
     <item name="android:textColor">#00ffff</item>  
    </style>  
    

    Regards,
    Kyle


    If the response is helpful, please click "Accept Answer" and upvote it.

    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.


0 additional answers

Sort by: Most helpful

Your answer

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