-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ComboBox: support different DataTemplate for selected item. #15420
Conversation
You can test this PR using the following package version. |
src/Avalonia.Controls/Converters/MultiDataTemplatesConverter.cs
Outdated
Show resolved
Hide resolved
Can we please call this My first thought while reading this PR was that the |
Updated according to reviews. |
You can test this PR using the following package version. |
Other controls call this property ContentTemplate |
* feat: ComboBox: support different DataTemplate for selected item. * feat: use coerce instead of multi binding. * test: add multiple unit tests.
What does the pull request do?
Add a new Property SelectedItemTemplate, if set, it has a higher priority than ItemTemplate.
What is the current behavior?
Displayed selected item is always the same as ComboBoxItem
What is the updated/expected behavior with this PR?
Make it possible to use different DataTemplates for selected item and other items.
How was the solution implemented (if it's not obvious)?
Use multibinding and select the first valid IDataTemplate.
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues