Makes PropertyGrid for CoboBox show "(none)" when DataSource is null … #13860
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.
Fixes #12570
Root Cause
The
ComboBox.DataSource
property was missing aTypeConverter
to handle null value display inPropertyGrid
. WhenDataSource
is null,PropertyGrid
shows empty/blank instead of "(none)" text, breaking consistency with .NET Framework behavior and other similar properties likeDisplayMember
andValueMember
.Proposed changes
DataSourceConverter
class that inherits fromReferenceConverter
and converts null values to "(none)" for string displayTypeConverter
attribute toComboBox.DataSource
property to use the new converterCustomer Impact
Restores .NET Framework parity for PropertyGrid display. Developers using
PropertyGrid
to inspectComboBox
properties will now see consistent "(none)" text whenDataSource
is null, improving design-time experience.Regression?
No. This is a missing feature/behavior that existed in .NET Framework but was lost in .NET Core migration.
Risk
Minimal.
Screenshots
Before
After
Test methodology
DataSourceConverter
covering null conversion, culture handling, and edge casesPropertyGrid
andComboBox
to verify "(none)" displayTest environment(s)
Microsoft Reviewers: Open in CodeFlow