Inheritance: Element -> NavigableElement -> VisualElement -> View -> InputView
Xamarin.Forms documentation: SearchBar API / Guide

For details on how the control actually works, please refer to the Xamarin.Forms documentation.


SearchBar(text: string, onTextChanged: string -> ‘msg, onSearchButtonPressed: ‘msg)Defines a SearchBar widget with a text, onTextChanged and onSearchButtonPressed events.


cancelButtonColor(light: FabColor, ?dark: FabColor)Sets a value that indicates the color of the cancel button depending if light or dark mode.
font(?size: float, ?namedSize: NamedSize, ?attributes: FontAttributes, ?fontFamily: string)Sets the font family used
horizontalTextAlignment(value: TextAlignment)Sets the horizontal text alignment.
verticalTextAlignment(value: TextAlignment)Sets the vertical text alignment.
reference(value: ViewRef<SearchBar>)Sets a ViewRef instance to retrieve the Xamarin.Forms.SearchBar instance associated to this widget


SearchBar("Enter a description", TextChanged, SearchButtonPressed)
    .cancelButtonColor(Color.Green.ToFabColor(), Color.White.ToFabColor())
    .textColor(Color.Red.ToFabColor(), Color.Blue.ToFabColor())
    .font(namedSize = NamedSize.Large, fontFamily = "Arial", attributes = FontAttributes.Bold)

Get access to the underlying Xamarin.Forms.SearchBar

let searchBarRef = ViewRef<SearchBar>()

SearchBar("Enter a description", TexChanged, SearchButtonPressed)