How to change background color for maui searchbar and stepper

Haviv Elbsz 1,751 Reputation points

Hello all the searchbar and stepper have no properties for background color. Is there a way to change background color for them. Thank you

A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,580 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 64,006 Reputation points Microsoft Vendor


    Is there a way to change background color for them


    • For Searchbar, please open the Resources\Styles\Styles.xaml file, then find the <Style TargetType="SearchBar"> tag, change the value of <Setter Property="BackgroundColor" Value="Green" />, I set the green for testing.


    • For Stepper, you can change the background color by Handler. Change the Button's background color by linearLayout.GetChildAt(0).SetBackgroundColor(Android.Graphics.Color.Red);.
       Microsoft.Maui.Handlers.StepperHandler.Mapper.AppendToMapping("MyCustomization", (handler, view) =>
    #if ANDROID
                 Android.Widget.LinearLayout linearLayout= handler.PlatformView as Android.Widget.LinearLayout;

    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful