.NET MAUI AutoComplete Visual States
This article describes the visual states provided by the AutoComplete control. You can use these visual states to change the appearance of the control based on its state—such as when it’s disabled, focused, hovered, and more.
The AutoComplete provides the following CommonStates
visual states:
Visual State | Description |
---|---|
Normal |
Applies when the AutoComplete is in its normal state. |
Focused |
Applied when the AutoComplete receives focus. |
MouseOver |
(Windows-only) Applied when the mouse cursor is hovering over the AutoComplete. |
PointerOver |
(MacCatalyst-only) Applied when the mouse cursor is hovering over the AutoComplete. |
Disabled |
Applied when the AutoComplete's IsEnabled is False . |
Using the Visual States
The example below demonstrates some of the styling capabilities of the AutoComplete, such as custom ClearButtonStyle
, TextInputStyle
, TextColor
, PlaceholderColor
, and others. It also shows how to switch its appearance through the .NET MAUI Visual State Manager.
1. Add a Style that targets the RadAutoComplete
to your page's resources and apply all the needed styling properties and the visual states:
2. Define the AutoComplete in XAML:
3. Create the needed business objects, for example type Client
with the following properties:
4. Create a ViewModel
with a collection of Client
objects:
Here is how the AutoComplete looks when styling is applied:
For a runnable example demonstrating the AutoComplete's Visual States, see the SDKBrowser Demo Application and go to the AutoComplete > Styling category.