Configure the .NET MAUI ComboBox
The purpose of this help article is to show the basic configuration options of the ComboBox control.
Placeholder
-
Placeholder
(string
): Sets thehe text which is used to give guidance to the end user on what should be entered/searched in the input. The watermark text is displayed when the input field is empty, or the selected item/s is/are cleared. -
PlaceholderColor
(Color
): Defines the color for the watermark text.
Here is an example of setting the Placeholder
property:
<telerik:RadComboBox Placeholder="Select City!"
ItemsSource="{Binding Items}"
DisplayMemberPath="Name"
AutomationId="placeholderCombo"/>
and the result:
Text
-
Text
(string
): Specifies the Text of the control. This is the Text that gets visualized when the control is editable or when it is non-editable and the selection mode is single.
ClearButton Visibility
The visibility state of the Clear X button can be changed using the IsClearButtonVisible
(bool
) property. By default its value is true.
Here is an example with IsClearButtonVisible
property set:
<telerik:RadComboBox IsClearButtonVisible="False"
ItemsSource="{Binding Items}"
DisplayMemberPath="Population"
IsEditable="True"
SearchTextPath="Population"
Keyboard="Numeric"
AutomationId="noClearnButtonCombo"/>
and the result:
DropDown Behavior
ComboBox provides the following properties for managing the drop down visbility:
-
IsDropDownOpen
(bool
): Defines whether the drop down part of the control is opened. Default value istrue
. -
IsDropdownClosedOnSelection
(bool
): Defines whether the drop down should be closed when item is selected/deselected. The default value istrue
.
Here is an example with IsDropdownClosedOnSelection
property set:
<telerik:RadComboBox IsDropDownClosedOnSelection="False"
ItemsSource="{Binding Items}"
DisplayMemberPath="Name"
AutomationId="openedAfterSelectionCombo"/>
-
OpenOnFocus
(bool
):Defines whether the drop down should be opened when the control is focused. The default value istrue
. It is only applicable for Editable ComboBox.
Here is an example with OpenOnFocus
property set:
<telerik:RadComboBox OpenOnFocus="False"
ItemsSource="{Binding Items}"
IsEditable="True"
SearchTextPath="Name"
DisplayMemberPath="Name"
AutomationId="notOpeningOnFocusCombo"/>
Keyboard
The Keyboard
property of type Microsoft.Maui.Keyboard
allows you to define the type of the keyboard that will be visualized by the device. The default value is Text.
The Configuration example can be found in our SDK Browser Application. You can find the application in the Examples folder of your local Telerik UI for .NET MAUI installation or in the following GitHub repo.