Repository navigation
Support Value pattern on editable ComboBox automation peer - #21545
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates ComboBoxAutomationPeer so editable ComboBox controls expose their editable text via the UI Automation Value pattern, allowing automation clients to read and set ComboBox.Text without accessing template parts.
Changes:
- Implement
IValueProviderbehavior conditional onComboBox.IsEditable(IsReadOnly,Value, andSetValue). - Raise automation property changed events when
TextorIsEditablechanges. - Add unit tests covering read-only behavior, value get/set, exception behavior, and value change notifications.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Avalonia.Controls/Automation/Peers/ComboBoxAutomationPeer.cs | Implements Value pattern support for editable ComboBox and raises related automation property change events. |
| tests/Avalonia.Controls.UnitTests/Automation/ComboBoxAutomationPeerTests.cs | Adds unit tests validating the new Value pattern behavior and event raising. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
You can test this PR using the following package version. |
MrJul
added this pull request to the merge queue
Jun 11, 2026
MrJul
pushed a commit
to MrJul/Avalonia
that referenced
this pull request
Jun 23, 2026
…I#21545) * Support Value pattern on editable ComboBox automation peer * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
Makes
ComboBoxAutomationPeerexpose the editable text through the Value pattern. Previously the peer hardcodedIsReadOnly => true, returned the selected item's name asValue, and threw fromSetValue, so automation clients couldn't read or set the text of an editable ComboBox without reaching into the internalPART_EditableTextBoxtemplate part.What is the updated/expected behavior with this PR?
For an editable ComboBox (
IsEditable=true):IsReadOnlyis false,ValuereturnsText, andSetValuesetsText. Non-editable ComboBoxes are unchanged (read-only, value is the selected item name).ValuePropertychange notifications fire whenTextchanges, andIsReadOnlyPropertywhenIsEditablechanges. Verified on macOS through the AX bridge:GetValue/SetValueon the ComboBox element read and write the editable text, with no native change needed.How was the solution implemented (if it's not obvious)?
IValueProvideron the peer now branches onOwner.IsEditable, andOwnerPropertyChangedraises the value/read-only notifications. Six unit tests cover read-only state per editability, value get/set, the non-editable throw, and the change event.