Skip to content

PropertyGrid.ResetHelpForeColor resets the back color instead of the fore color #14571

Closed

Description

@ricardobossan

.NET version

.NET 11 (and every shipped release back to the initial WinForms source import in commit 195f89af7).

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No. The line was added in the initial WinForms source import (195f89af7, "Added System.Windows.Forms source") and has not been modified since (only a path move in 17fd2a33ec).

Issue description

PropertyGrid.ResetHelpForeColor calls _helpPane.ResetBackColor() instead of _helpPane.ResetForeColor():

// src/System.Windows.Forms/System/Windows/Forms/Controls/PropertyGrid/PropertyGrid.cs:3631
private void ResetHelpForeColor() => _helpPane.ResetBackColor();

Steps to reproduce

Direct invocation (no public-API repro exists):

using PropertyGrid grid = new();
grid.HelpForeColor = Color.Red;
grid.HelpBackColor = Color.Yellow;

grid.TestAccessor.Dynamic.ResetHelpForeColor();

// Expected: HelpForeColor == SystemColors.ControlText, HelpBackColor == Color.Yellow
// Actual:   HelpForeColor == Color.Red,                HelpBackColor == SystemColors.Control

Activity

  1. added
    untriaged
    on May 28, 2026
  2. added
    waiting-review
    and removed
    untriaged
    on May 28, 2026
  3. added a commit that references this issue on Jul 2, 2026
    9bb0153
  4. added this to the 11.0-preview7 milestone on Jul 3, 2026
  5. Zheng-Li01 commented on Jul 3, 2026

    @Zheng-Li01
    Member

    Tested in the latest .NET 11 Preview 7 build: 11.0.100-preview.7.26352.103 + built private dls from the main branch of Winforms repo, it was fixed as below screenshot.

    WinFormsApp46.zip

    Image
  6. Amy-Li03 commented on Aug 3, 2026

    @Amy-Li03
    Contributor

    Hi @ricardobossan ,

    ResetHelpForeColor() successfully restores the default help text color on the first invocation. However, after changing the parent form's ForeColor, the PropertyGrid.HelpForeColor is updated accordingly.
    Subsequent calls to ResetHelpForeColor() do not restore the original default color. Instead, the current inherited color appears to be treated as the default value.

    It is unclear whether HelpForeColor is intended to track changes to the parent form's ForeColor, or whether the reset behavior is incorrect in this scenario.

    Image
  7. ricardobossan commented on Aug 4, 2026

    @ricardobossan
    MemberAuthor

    Hi @ricardobossan ,

    ResetHelpForeColor() successfully restores the default help text color on the first invocation. However, after changing the parent form's ForeColor, the PropertyGrid.HelpForeColor is updated accordingly. Subsequent calls to ResetHelpForeColor() do not restore the original default color. Instead, the current inherited color appears to be treated as the default value.

    It is unclear whether HelpForeColor is intended to track changes to the parent form's ForeColor, or whether the reset behavior is incorrect in this scenario.

    Image

    Thanks for testing this further, @Amy-Li03 .

    This part is expected behavior, not a bug: HelpForeColor/ResetHelpForeColor() are a thin wrapper over the internal help pane's ForeColor/ResetForeColor(), and Control.ForeColor is documented as an ambient property. ResetForeColor() doesn't restore a fixed original value, it clears any explicit override so the control goes back to tracking its parent's color. Once you change the parent form's ForeColor, the help pane (still in the "not explicitly set" state after the first reset) picks up that new value automatically, and a second ResetHelpForeColor() has nothing left to reset since it's already tracking the ambient value.

    You can see the same thing with any plain control, e.g. a Label on the same form: label.ResetForeColor(), then change the form's ForeColor, then label.ResetForeColor() again; same result. So this isn't specific to HelpForeColor or related to the fix in #14572, which only corrected ResetHelpForeColor calling the wrong internal method (ResetBackColor instead of ResetForeColor) and didn't touch the ambient-reset semantics at all.

  8. Amy-Li03 commented on Aug 5, 2026

    @Amy-Li03
    Contributor

    @ricardobossan
    Thanks for the clarification. I tested the same scenario with a regular Label and observed identical behavior after calling ResetForeColor(). Your explanation about ambient property inheritance makes sense: ResetForeColor() does not restore a fixed original value, but instead clears any explicit override and returns the control to its ambient state. As a result, the control resumes tracking its parent's ForeColor, so later changes to the parent are reflected automatically, and subsequent calls to ResetForeColor() have nothing left to reset.

  9. locked and limited conversation to collaborators on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

waiting-review

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions