Implement DropDownList component with shared ListItem infrastructure#282
Merged
Conversation
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement DropDownList component for Blazor
Implement DropDownList component with shared ListItem infrastructure
Jan 28, 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.
Implements the
DropDownListcomponent to emulate ASP.NET Web FormsSystem.Web.UI.WebControls.DropDownList, rendering as an HTML<select>element with data binding and event support.Implementation
Core Components
ListItem/ListItemCollection- Shared classes for list-based controls (CheckBoxList, RadioButtonList, ListBox will reuse)DropDownList<TItem>- Generic component inheriting fromDataBoundComponent<TItem>withIStylesupportKey Features
StaticItemsparameter (ListItemCollection)DataTextField/DataValueFieldfor complex objects@bind-SelectedValueSelectedIndextracking andSelectedItemaccessorOnSelectedIndexChangedevent handlerUsage
Testing & Documentation
Original prompt
This section details on the original issue you should resolve
<issue_title>Implement DropDownList Component</issue_title>
<issue_description>## Overview
Implement the DropDownList Blazor component that emulates the ASP.NET Web Forms
System.Web.UI.WebControls.DropDownListcontrol. This is a commonly used selection control that renders as an HTML<select>element with<option>children.Microsoft Docs Reference: https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.dropdownlist?view=netframework-4.8
Phase 1: Research & Reference Setup
Step 1: Add Web Forms Sample Page
Create sample page at
samples/BeforeWebForms/ControlSamples/DropDownList/Default.aspx:Create code-behind
Default.aspx.cs:Step 2: Capture HTML Output
Run the BeforeWebForms project and document the exact HTML output. Expected patterns:
Basic DropDownList:
With Selected Item:
With CSS Class:
Disabled:
Phase 2: Blazor Implementation
Step 3: Create Supporting Classes
First, create the
ListItemclass atsrc/BlazorWebFormsComponents/ListItem.cs:Create
ListItemCollectionatsrc/BlazorWebFormsComponents/ListItemCollection.cs: