Extended-Toolkit icon indicating copy to clipboard operation
Extended-Toolkit copied to clipboard

[Bug]: TreeGridView: Plus/Minus Sign Not Displayed in TreeGrid and Collapse/Expand Behaviors Broken

Open Lephat902 opened this issue 7 months ago • 2 comments

Describe the bug The plus/minus sign for expanding/collapsing tree nodes is not visible in the KryptonTreeGridView. Additionally, after collapsing and then expanding all nodes, the data structure appears to "flush down" incorrectly.

To Reproduce

  1. Set up a KryptonTreeGridView with the following configuration in Form1.designer.cs:
ktgv1.AllowUserToAddRows = false;
ktgv1.AllowUserToDeleteRows = false;
ktgv1.BorderStyle = BorderStyle.None;
ktgv1.ColumnHeadersHeight = 36;
ktgv1.DataSource = null;
ktgv1.Dock = DockStyle.Fill;
ktgv1.EditMode = DataGridViewEditMode.EditProgrammatically;
ktgv1.ImageList = null;
ktgv1.Location = new Point(0, 0);
ktgv1.Name = "ktgv1";
ktgv1.RowHeadersWidth = 51;
ktgv1.Size = new Size(800, 450);
ktgv1.TabIndex = 0;
  1. Add a tree structure with nodes in the Form1.cs constructor:
public Form1()
{
    InitializeComponent();

    // Example of adding nodes
    // Define columns
    ktgv1.Columns.Add(new KryptonTreeGridColumn { HeaderText = "name", DataPropertyName = "Column1" });
    ktgv1.Columns.Add(new KryptonDataGridViewTextBoxColumn { HeaderText = "age", DataPropertyName = "Column2" });
    ktgv1.Columns.Add(new KryptonDataGridViewTextBoxColumn { HeaderText = "birthdate", DataPropertyName = "Column3" });
    ktgv1.Columns.Add(new KryptonDataGridViewTextBoxColumn { HeaderText = "job", DataPropertyName = "Column4" });

    var rootNode = ktgv1.GridNodes.Add("Root", "", "", "");
    var childNode1 = rootNode.Nodes.Add("jane doe", "18", "2022-12-12", "engineer");
    var childNode2 = rootNode.Nodes.Add("joe doe", "18", "2022-12-12", "engineer");
    childNode1.Nodes.Add("ch-joe doe", "18", "2022-12-12", "engineer");
    for (int i = 0; i < 3; i++)
    {
        var childNodex = rootNode.Nodes.Add($"ch-joe doe {i}", "18", "2022-12-12", "engineer");
        for (int j = 0; j < 3; j++)
        {
            childNodex.Nodes.Add($"ccx - joe doe {i}", "18", "2022-12-12", "intern");
        }

    }
    ktgv1.ExpandAll();
}

Here is the whole code repository: WinFormsApp1.zip

Expected behavior

  • The plus/minus signs for expanding/collapsing nodes should be visible.
  • The expand/collapse behavior should function correctly without flushing data.
  • After clicking Collapse All and Expand All, the nodes should properly display their states (expanded or collapsed), and the data should remain intact.

Screenshots Here are some screenshots to clarify:

  1. At first it is as below, the plus/minus signs are missing for the expanded nodes: Image
  2. Then I click Collapse button at root node, it is this way: Image
  3. Then I click Expand All again, it becomes weird: Image

Desktop:

  • OS: Windows 11
  • Version: 26100.3915
  • Framework/.NET Version: 9.0.4
  • Toolkit Version: 95.25.4.111

Lephat902 avatar May 23 '25 08:05 Lephat902