Do not reset user fonts in DataGridView#3875
Conversation
Codecov Report
@@ Coverage Diff @@
## release/5.0-rc2 #3875 +/- ##
==========================================================
- Coverage 67.60904% 36.58130% -31.02774%
==========================================================
Files 1408 921 -487
Lines 507123 250967 -256156
Branches 41178 36862 -4316
==========================================================
- Hits 342861 91807 -251054
+ Misses 158290 153877 -4413
+ Partials 5972 5283 -689
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
@dreddy-work @Tanya-Solyanik @KlausLoeffelmann - do you all like this fix? Seems like a reasonable approach, but another set of eyes on it would be great. I know @RussKie has a bit more to do to polish things up, but if we can get this in for RC2 that would rock. |
|
@RussKie , did you investigate other controls that has text input? Are we confirming that this is happening to only DataGridView* controls? |
This comment has been minimized.
This comment has been minimized.
9cb0b8f to
f90031b
Compare
f90031b to
463dc93
Compare
|
@JeremyKuhne I didn't include EMF-based tests as I ran into few issues with those (e.g. it wouldn't size columns, and we don't appear to have Font validators available). |
Yes, appears to be only DGV cellstyles-related issue. |
We do have a text out validator- it is how we validate the button text. What records were you getting that you couldn't validate? |
|
Tested by CTI. |
|
@merriemcgaw, @RussKie , @OliaG - is there a place to document the scenario that this change is breaking? Perhaps in the application migration guide? |
src/System.Windows.Forms/src/System/Windows/Forms/DataGridView.Methods.cs
Outdated
Show resolved
Hide resolved
@RussKie , do you have all the info you need to doc the breaking change? |
|
This will need to be doc'ed in https://docs.microsoft.com/en-us/dotnet/core/compatibility/winforms once we take it. |
|
I've revisited the fix, and we can do away with the new property. All the existing and interactive test results remained positive: However I found another related bug or ("feature" if you like) that makes it very awkward user experience. If one of winforms/src/System.Windows.Forms/src/System/Windows/Forms/DataGridView.cs Lines 2072 to 2115 in 1185aac This isn't something we're fixing in the context of this PR, or in .NET 5.0 timeframe. |
463dc93 to
59d0fbf
Compare
59d0fbf to
31c4c43
Compare
@RussKie can you file a separate issue for this related potential problem? |
Whenever ambient font changed, this change would stomp over user-defined DataGridView font styles, such as * DefaultCellStyle * ColumnHeadersDefaultCellStyle * RowHeadersDefaultCellStyle Whilst the behaviour goes all the way back to .NET Framework, it becomes a significant migration issue for projects that want to keep the original default font (that was changed in dotnet#656). Prevent changes to either of the above cellstyles, if those configured by a user. Resolves dotnet#3033
31c4c43 to
36f3117
Compare
src/System.Windows.Forms.Primitives/tests/TestUtilities/Metafiles/EmfScope.cs
Show resolved
Hide resolved
|
Docs: dotnet/docs#20803 |

Fixes #3033
Proposed changes
DataGridViewwhenever ambient (e.g. form's) font changes.This scenario is likely to occur when users migrate their applications from .NET Framework to .NET Core/.NET and wish to retain the original default font.
Whilst the behaviour goes all the way back to .NET Framework, it becomes a significant migration issue for projects that want to keep the original default font (that was changed in #656).
Customer Impact
Regression?
Risk
Screenshots
Before
After
Test methodology
Microsoft Reviewers: Open in CodeFlow