diff --git a/docs/reference/controls/combobox.md b/docs/reference/controls/combobox.md index dde3b0716..d57f2e18f 100644 --- a/docs/reference/controls/combobox.md +++ b/docs/reference/controls/combobox.md @@ -31,6 +31,8 @@ You will probably use these properties most often: | `MaxDropDownHeight` | The maximum height for the dropdown list. This is the actual height of the list part, not the number of items that show. | | `ItemPanel` | The container panel to place items in. By default, this is a StackPanel. See [this page](../../concepts/custom-itemspanel) to customise the ItemsPanel.| | `Styles` | The style that is applied to any child element of the ItemControl. | +| `IsEditable` | Allows the user to type any value into the `ComboBox`. Make sure to use `DisplayMemberBinding` or `TextSearch.TextBinding` if using complex item types as otherwise it will use `ToString` on the object. | +| `Text` | When `IsEditable` `Text` will be the text value of the `SelectedItem` or the text a user has entered. | ## Examples @@ -125,6 +127,34 @@ namespace AvaloniaControls.Views +When using `IsEditable` with complex types by default the `Text` will retreived from `ComplexType`.`ToString`, to change this set either `DisplayMemberBinding` or `TextSearch.TextBinding`, or both. + +The below example of an `IsEditable` `ComboBox` uses a property named `Id` to match items when typing in text. When the `ComboBox` is open the items in the dropdown will be displayed using `DisplayValue`: + +```xml + +``` + +```csharp title='C#' +public class ComplexItem +{ + public int Id { get; set; } + public string DisplayValue { get; set; } +} + +public class ViewModel +{ + public string EditableText { get; set; } + public ComplexItem? Selected { get; set; } +} +``` + ## More Information :::info