Update combobox.md for IsEditable changes#633
Update combobox.md for IsEditable changes#633almightyju wants to merge 2 commits intoAvaloniaUI:mainfrom
Conversation
docs/reference/controls/combobox.md
Outdated
| <img src={ComboBoxDataTemplateScreenshot} alt="" /> | ||
|
|
||
| When using `IsEditable` with complex types it is important to set either `DisplayMemberBinding` or `TextSearch.TextBinding`, or both. | ||
| A complex example of the editable text using `Id` to match items when typing in text, but the showing `DisplayValue` in the dropdown is found below: |
There was a problem hiding this comment.
I think this needs to be reworded. It took me a few tries to parse it. Perhaps:
| A complex example of the editable text using `Id` to match items when typing in text, but the showing `DisplayValue` in the dropdown is found below: | |
| The below example uses a property named `Id`, to match items when typing in text to a `ComboBox` that has `IsEditable` set to true. The display value in the `ComboBox` will be the bound `DisplayValue` value: |
There was a problem hiding this comment.
Yeah this one is tricky without a visual, I went thought a few iterations myself. Basically in that example:
- Items in the open dropdown will display using
DisplayMemberBinding - The editable portion (i.e.
TextBox) will select items that matchTextSearch.TextBindingand also display the value usingTextSearch.TextBinding
Does listing those bullet points make more sense how it works to you?
There was a problem hiding this comment.
It is certainly an improvement. If you do go with that, I would suggest a slight change:
Say "will select an item that matches" instead of "selects items", as it makes it sounds like it will match multiple values at once.
docs/reference/controls/combobox.md
Outdated
|
|
||
| <img src={ComboBoxDataTemplateScreenshot} alt="" /> | ||
|
|
||
| When using `IsEditable` with complex types it is important to set either `DisplayMemberBinding` or `TextSearch.TextBinding`, or both. |
There was a problem hiding this comment.
What happens if you don't?
There was a problem hiding this comment.
I would say that should be mentioned somewhere then.
docs/reference/controls/combobox.md
Outdated
| ``` | ||
|
|
||
| ```csharp title='C#' | ||
| public record ComplexItem(int Id, string DisplayValue); |
There was a problem hiding this comment.
I generally suggest people avoid using newer C# features like records for docs. Avalonia technically supports all the way back to .NET 4.8, which means people may have to rewrite the code if they are trying to use it there.
There was a problem hiding this comment.
Good point, I was trying to make the c# part concise, I'll update to use a class instead
docs/reference/controls/combobox.md
Outdated
| A complex example of the editable text using `Id` to match items when typing in text, but the showing `DisplayValue` in the dropdown is found below: | ||
|
|
||
| ```xml | ||
| <ComboBox PlaceholderText="Editable" IsEditable="true" |
There was a problem hiding this comment.
Put IsEditable on a different line like the rest of the properties are. It makes it a lot more readable. I almost missed it was there.
This is for AvaloniaUI/Avalonia#18094 so only merge if that pull request is accepted 😄
I'm not sure of how best to record an image for the example I've added but can happily add if someone is willing to make one?