Skip to content
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

[Bug]: Exapanding a TreeGridView Node takes a long time when there are many children #411

Open
pauldeboer1987 opened this issue Feb 27, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@pauldeboer1987
Copy link

Describe the bug
When I have many children in a TreeGridView (like 200) the performance is very slow to expand and collapse the node.

About 250 children takes about 6 seconds on my computer

To Reproduce
Steps to reproduce the behavior:

  1. Create a TreeGridView
  2. add a node
  3. add 250 children nodes
  4. click the + or -

Expected behavior
A resonable time of 0.5s sounds reasonable

Desktop (please complete the following information):
Win .NET 6.0 C#
Krypton.Toolkit.Suite.Extended.TreeGridView.Canary
80.23.2.51-beta

@pauldeboer1987 pauldeboer1987 added the bug Something isn't working label Feb 27, 2023
@Smurf-IV
Copy link
Member

This is a known problem with the C# treeview.
What you can do as a workaround is (If memory serves) the following:

  • call the equivalent of SuspendLayout()
  • Expand collapse / update / delete rows
  • call ResumeLayout(true)

I also have disabled and re-enabled the control before and after the suspends / etc.; to make sure it is obvious that things are happening.

@pauldeboer1987
Copy link
Author

Hm.. I tried that.
I also tried suspend paint,
and setting the treegridview.visible to false
it still takes too long.
Similarly, hiding the nodes takes a long time.
this.SuspendLayout(); this.SuspendPaint(); treeGridView1.Visible = false; foreach (var node in treeGridView1.GridNodes) { node.Visible = false; foreach (var subnode in node.Nodes) { subnode.Visible = false; } } treeGridView1.Visible = true; this.ResumePaint(); this.ResumeLayout();
regardless, expanding or collapsing by clicking the + or - does the same.
Unless there is a expand/collapse event to catch, I don't see how I could put the suspend in front/behind.

Funny enough, its actually the set visible to false, or collapsing that takes too long. Expand seems fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants