Skip to content

Conversation

@corvinsz
Copy link
Member

@corvinsz corvinsz commented Oct 7, 2025

fixes #3939

This PR changes 2 things about the AutoSuggestBox:

  1. Horizontal- and VerticalContentAlignment of ListBoxItems in AutoSuggestBox (see the linked issue above). I would say we just stretch the content instead of adding new properties to the AutoSuggestBox. This way consumers can align the content themselfs by setting the Horizontal- and VerticalContentAlignment in the ItemTemplate.
  2. allows for "interactable" content in the suggestion ListBox.

Additionally I refactored the demo to use the CommunityToolkit.MVVM toolkit and added an additional AutoSuggestBox example.

Before

autoSuggestBoxPre.mp4

After

autoSuggestBoxPost.mp4

Refactored `FieldsViewModel` to use `CommunityToolkit.Mvvm` attributes, reducing boilerplate code and improving maintainability.

Added `AutoSuggestBox3` with dynamic filtering, interactive item templates, and a command to remove suggestions. Enhanced `AutoSuggestBox` behavior to support interactive elements like buttons without closing the popup.

Updated `Fields.xaml` to include new `AutoSuggestBox` variations and bindings. Introduced a new `AutoSuggestTextBoxWithInteractiveTemplate` sample to demonstrate interactive item templates.

Added tests to validate interactive `AutoSuggestBox` behavior. Performed general cleanup and modernization, including concise syntax and collection initializers.
Included System.Windows.Documents namespace to support
Hyperlink functionality. Updated IsInteractiveElement
method to recognize Hyperlink as an interactive element,
alongside ButtonBase, TextBoxBase, and ComboBox.
@Keboo Keboo added this to the 5.3.1 milestone Oct 31, 2025
Introduces an `IsInteractiveElement` attached dependency property to `AutoSuggestBox`, updates `OnLostFocus` to prevent popup closure when the suggestion list is focused, refactors interactivity detection to prioritize the new attached property and perform visual tree traversal, and adds new UI tests to validate this functionality.
@Keboo Keboo enabled auto-merge (squash) October 31, 2025 05:41
@Keboo Keboo added enhancement release notes Items are likely to be highlighted in the release notes. labels Oct 31, 2025
@Keboo Keboo merged commit 5ec45a3 into MaterialDesignInXAML:master Oct 31, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement release notes Items are likely to be highlighted in the release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HorizontalContentAlignment of ListBox in AutoSuggestBox

2 participants