Skip to content

Investigate TreeView.FullRowSelect appearing ineffective #13

Description

@KlausLoeffelmann

Summary

While checking Klaus' report that TreeView.FullRowSelect "does not work anymore", I could not find a TreeView code regression on either origin/main or origin/VisualStylesNet11.

Current best diagnosis: this is most likely the long-standing native TreeView constraint that FullRowSelect has no visual effect when ShowLines is true (which is the WinForms default), not a new regression.

Repro snippet

using System.Windows.Forms;

Application.EnableVisualStyles();
Application.Run(new Form
{
    Controls =
    {
        new TreeView
        {
            Dock = DockStyle.Fill,
            FullRowSelect = true,
            HideSelection = false,
            // ShowLines stays at its default: true
            Nodes =
            {
                new TreeNode("Root")
                {
                    Nodes = { new TreeNode("Child") }
                }
            }
        }
    }
});

Actual behavior

With the default ShowLines = true, the selection highlight does not appear to span the full row, which makes FullRowSelect look broken.

Expected behavior

Either:

  1. the control should make it much clearer that FullRowSelect is ineffective while ShowLines is enabled, or
  2. if we believe the current behavior is too surprising, we should decide whether to add a dedicated regression/integration test and/or improve docs / sample coverage.

Investigation findings

origin/main

I verified that the managed wrapper still applies the expected native style:

  • TreeView.CreateParams still ORs TVS_FULLROWSELECT when FullRowSelect is true.
  • The FullRowSelect property documentation in TreeView.cs still explicitly says: "This property will have no effect if ShowLines is true."
  • Existing unit tests for the current code path passed locally, including:
    • TreeView_CreateParams_GetFullRowSelect_ReturnsExpected
    • FullRowSelect_SetWithHandle_GetReturnsExpected
    • FullRowSelect_SetWithUpdateStylesHandlerWithHandle_CallsStyleChangedCallsInvalidated

So on plain main, I could confirm the style wiring is still present; I did not find evidence that the FullRowSelect implementation itself regressed.

origin/VisualStylesNet11

I compared origin/main and origin/VisualStylesNet11 read-only.

  • There are no TreeView file changes between those branches under src/System.Windows.Forms/System/Windows/Forms/Controls/TreeView/.
  • The branch changes are concentrated in Control.cs, VisualStylesMode.cs, Button*, and TextBoxBase* work.

So I could not attribute the report to a TreeView-specific change on VisualStylesNet11.

Best current diagnosis (hypothesis)

This looks like a configuration / expectation trap, not a new branch regression:

  • FullRowSelect is set,
  • but ShowLines remains true (default),
  • and the native control therefore does not visually show full-row selection.

If Klaus' repro app left ShowLines at its default, that would explain the observation on both main and VisualStylesNet11.

Suggested follow-up

  • Re-run the visual repro with ShowLines = false explicitly set.
  • If the problem still reproduces with ShowLines = false, capture that exact repro separately, because that would point to a different issue than the one I could verify from source/tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions