1

I have been tasked with creating a like for like user interface for a product replacement. One of the components of the old system was a container that displayed properties in a hierarchy (think treeview like) where each property had a label and value (value could be a textbox, drop down, checkbox, file browse etc) This is the component that I need to replace and one of the conditions being imposed on me is to front load it with about 5000 items, some of which will be made visible depending on usage context.

My first attempt has been to use a FlowLayoutPanel as the main container populated by TableLayoutPanels indented on left margin that each hold label and edit control. I hit the problem of the 10,000 control handles limit.

Any suggestions on an alterantive approach to get round this limitation that will allow for the front loading of the 5000 items?

Thanks in advance.

  • https://stackoverflow.com/a/39810717/14171304 – dr.null Jan 25 '22 at 23:53
  • The linked post is a nice one by Taw. It gives some idea, however, it doesn't solve this issue because the post relies on a list of created controls, so you need to create those handles. One improvement could be relying on list of data, then after scroll, create new controls and **Dispose** the current controls. – Reza Aghaei Jan 26 '22 at 00:09
  • Another idea could be just using a few created controls (base on the veiw port size); then by each scroll load corresponding data and show in those controls. Then you don't need to add/remove controls on the fly. – Reza Aghaei Jan 26 '22 at 00:13

1 Answers1

4

Consider the following guidelines:

1. Do not load all the records at once. Load the data page by page as per request, and render each page of data.

2. Do not show all the records at once. You have a limited window size, even if you load all the data, just show the part that should be visible in the view port. Show the rest of the data when the user scrolls. This way you can dispose the previous elements.

3. Do not use a lot of handles. You can use a control which uses just 1 control handle, like a TreeView or DataGridView or even a custom control for yourself. The key is keeping data in view mode and just show the edit controls when the user focus on a specific item to edit.

Example: DataGridView and ListView controls support virtual mode for loading data. You can also simulate nested data by padding the first cell/item. Also the Treeview control supports events like BeforeExpand which allows you to load child data when the user requests. For all above examples you can just show the edit controls when the user wants to edit the cell.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398