Fixes #4851 - Add DropDownList<TEnum> for type-safe enum selection - #4852
Merged
Merged
Conversation
…ctor<TEnum> API Co-authored-by: tig <585482+tig@users.noreply.github.com> Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/e9bc95d7-8298-4923-b15d-2c55f6df3d7c
Copilot
AI
changed the title
[WIP] Add DropdownList<T> for enum support
Fixes #issue. Add DropDownList<TEnum> for type-safe enum selection
Mar 24, 2026
Member
|
@copilot ci/cs |
Co-authored-by: tig <585482+tig@users.noreply.github.com> Agent-Logs-Url: https://github.com/gui-cs/Terminal.Gui/sessions/e0f28c7c-fbad-4776-8d2c-9d2ea8b6e175
Contributor
Author
Copilot
AI
changed the title
Fixes #issue. Add DropDownList<TEnum> for type-safe enum selection
Add DropDownList<TEnum> for type-safe enum selection
Mar 24, 2026
tig
approved these changes
Mar 25, 2026
tig
marked this pull request as ready for review
March 25, 2026 01:14
BDisp
approved these changes
Mar 25, 2026
Update ApplicationMouse to track active popover at mouse press and suppress Clicked events if the popover closes during the press → release → click cycle, preventing event leakage to underlying views. Add trace logging for this suppression. Refactor DropDownListExample to use Value instead of Text for read-only dropdown initialization and condense enum dropdown setup.
This was referenced May 1, 2026
This was referenced May 21, 2026
This was referenced Jun 1, 2026
This was referenced Jun 15, 2026
This was referenced Jul 13, 2026
This was referenced Aug 19, 2026
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.
DropDownListwas cumbersome to use with enum sources, requiring manual population and string-to-enum conversion at every call site.DropDownList<TEnum>closes the gap withOptionSelector<TEnum>— the two are now interchangeable for enum-backed selection, differing only in appearance and size.Proposed Changes/Todos
Terminal.Gui/Views/DropDownListTEnum.cs— newsealed class DropDownList<TEnum> : DropDownList, IValue where TEnum : struct, EnumSourcefromEnum.GetValues<TEnum>()TEnum? Valueproperty (get parsesTextviaEnum.TryParse; set writesvalue.ToString())event EventHandler<EventArgs<TEnum?>>? ValueChanged— mirrorsOptionSelector<TEnum>exactlyIValue.GetValue()for data bindingDropDownListExample.cs— addedDropDownList<DayOfWeekShort>demo in the UICatalog scenarioDropDownListTests.cs— addedDropDownListGenericTests(11 tests: source population, value round-trip, event firing, interchangeability assertion)CS0266:IListDataSource.ToList()returns non-genericSystem.Collections.IList; added explicit.Cast<object?>()in test assertionBefore / After
Pull Request checklist:
CTRL-K-Dto automatically reformat your files before committing.dotnet testbefore commit///style comments)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.