SearchBar
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.
Constructors
| Constructors | Description |
|---|---|
| SearchBar(text: string, onTextChanged: string -> ‘msg, onSearchButtonPressed: ‘msg) | Defines a SearchBar widget with a text, onTextChanged and onSearchButtonPressed events. |
Properties
| Properties | Description |
|---|---|
| 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\ |
Sets a ViewRef instance to retrieve the Xamarin.Forms.SearchBar instance associated to this widget |
Usages
SearchBar("Enter a description", TextChanged, SearchButtonPressed)
.keyboard(Keyboard.Email)
.cancelButtonColor(Color.Green.ToFabColor(), Color.White.ToFabColor())
.textColor(Color.Red.ToFabColor(), Color.Blue.ToFabColor())
.font(namedSize = NamedSize.Large, fontFamily = "Arial", attributes = FontAttributes.Bold)
.textTransform(TextTransform.Lowercase)
Get access to the underlying Xamarin.Forms.SearchBar #
let searchBarRef = ViewRef<SearchBar>()
SearchBar("Enter a description", TexChanged, SearchButtonPressed)
.reference(searchBarRef)