-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Makes PropertyGrid for CoboBox show "(none)" when DataSource is null … #13860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13860 +/- ##
====================================================
+ Coverage 77.12127% 97.41261% +20.29134%
====================================================
Files 3273 1210 -2063
Lines 644931 357040 -287891
Branches 47692 5581 -42111
====================================================
- Hits 497379 347802 -149577
+ Misses 143876 8455 -135421
+ Partials 3676 783 -2893
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
src/System.Windows.Forms/System/Windows/Forms/Controls/ComboBox/ComboBox.cs
Show resolved
Hide resolved
src/System.Windows.Forms.Design/src/System/Windows/Forms/Design/DataSourceConverter.cs
Show resolved
Hide resolved
|
||
namespace System.Windows.Forms.Design; | ||
|
||
internal class DataSourceConverter : ReferenceConverter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If have a few questions here:
- What was/is the behavior in NetFX here? Do we also have such a converter there?
- Is this just for the ComboBox? How does the ListBox for example handle this?
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