DisplayAlert button color

MikeBealeMikeBeale Member ✭✭

Where does DisplayAlert get the color used for the buttons?

Simply using DisplayAlert:
await DisplayAlert("Alert!", "This is DisplayAlert", "OK");

Is it possible to change this color on "OK"? It's also used in Picker and on Switch too.



  • dinesh314850dinesh314850 Member ✭✭

    Dear @MikeBeale
    You can get Latest Design Popup and Alert :

  • ColeXColeX Member, Xamarin Team Xamurai

    Different from Picker, Switch , DisplayAlert is not a rendered control in XF, we can't use custom renderer to customize it .

    You could write DependencyService for custom Dialogs and use some custom layouts.

    Refer the solution : https://forums.xamarin.com/discussion/comment/209602/#Comment_209602

  • MikeBealeMikeBeale Member ✭✭

    Thanks for your replies.

    @dinesh314850 That Popup plugin will come in useful for another project I have to do at a later date.

    @ColeX That looked a bit too much to simply change a color, it wasn't really important so thought I would leave it.

    But today I was looking into adding a SplashScreen and going through the Xamarin docs, one step was to add to the Resources/values/styles.xml file.
    In there I spotted an item called colorAccent
    Changing this does what I need, it changes the OK/Cancel buttons on DisplayAlert, the color on a Switch control, and also the color for the Entry field the cursor is in.

Sign In or Register to comment.