feat: Add DropDown UI element to built in UI library#3120
Draft
Acissathar wants to merge 1 commit intostride3d:masterfrom
Draft
feat: Add DropDown UI element to built in UI library#3120Acissathar wants to merge 1 commit intostride3d:masterfrom
Acissathar wants to merge 1 commit intostride3d:masterfrom
Conversation
Eideren
reviewed
Apr 5, 2026
Comment on lines
+430
to
+446
| /// <summary> | ||
| /// Traverses the visual tree rooted at <paramref name="root"/> and sets | ||
| /// <see cref="DropDown.IsInteractable"/> to <c>false</c> on every <see cref="DropDown"/> | ||
| /// found, preventing the control from responding to touch input in the editor viewport. | ||
| /// </summary> | ||
| private static void DisableDropDownInteraction(UIElement root) | ||
| { | ||
| if (root is DropDown dropDown) | ||
| dropDown.IsInteractable = false; | ||
|
|
||
| foreach (var child in root.VisualChildren.BreadthFirst(e => e.VisualChildren)) | ||
| { | ||
| if (child is DropDown childDropDown) | ||
| childDropDown.IsInteractable = false; | ||
| } | ||
| } | ||
|
|
Collaborator
There was a problem hiding this comment.
This seems a bit too specific, it's also fairly heavy and allocates quite a bit, things you could look into:
UIElement.IsHierarchyEnabled- How the scroll for panel works around this issue if it does.
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.
PR Details
Currently, the built in Stride UI library is missing a drop down element. You can probably throw one together yourself with multiple elements (button that onclick turns on a scrollable list, etc), but that's a bit unwieldy for a general purpose dropdown / combobox.
This is sort of a proof a concept, as I need it for my own project but haven't yet really put it through any real use cases and determined what all is missing with regards to functionality. Super dumb version of a dropdown, just a list with Text elements for the buttons and a SelectedIndex.
At a quick level, it supports the following properties for design:
Placeholder text is used when the Selected Index is -1, but the selected index can be defaulted to an actual item in the list instead if desired.
There is an event that's fired that can be subscribed to know when the index has changed.
It also supports hiding the scroll view when clicking outside of the list.
As mentioned above, I plan to use this in my project so there may be more tweaks which is why I'm throwing it up as a draft PR but also so that its out there if anyone has any functionality they think it should have that its missing, want to use it in the meantime, etc.
Related Issue
#2904
Types of changes
Checklist