Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly 100.25.10.300-alpha

This is a prerelease version of Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly --version 100.25.10.300-alpha
                    
NuGet\Install-Package Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly -Version 100.25.10.300-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly" Version="100.25.10.300-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly" Version="100.25.10.300-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly --version 100.25.10.300-alpha
                    
#r "nuget: Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly, 100.25.10.300-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly@100.25.10.300-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly&version=100.25.10.300-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly&version=100.25.10.300-alpha&prerelease
                    
Install as a Cake Tool

TreeGridView

History

The original source of this code came from "Mark Rideout" via https://docs.microsoft.com/en-us/archive/blogs/markrideout/customizing-the-datagridview-to-support-expandingcollapsing-ala-treegridview.

It was then taken for a ride by several developers to fix some issues, and extend it to take a data source. Then "AngeloCresta" created a Kryptonised version https://github.com/ncarp/ExtendedRenderer/tree/master/TreeGridView, but did not give any supporting examples of how to use it.

Sometime during amalgamation of the extended suite "WagnerP" moved the code into the code base https://github.com/Krypton-Suite-Legacy-Archive/Krypton-Toolkit-Suite-Extended-NET-5.470/tree/master/Source/Krypton%20Toolkit%20Suite%20Extended/Full%20Toolkit/Extended%20Controls/ExtendedToolkit/Controls/TreeGridView where it rested for a while.

Then "Smurf-IV", picked it up and

  • Found the above history,
  • Converted the code into the latest Extended standard way of doing things,
  • Fixed the code style and usages,
  • Added example usages (As far as possible),
  • and Created this read me 😉

Progmatic Creation

alternate text is missing from this package README image

DataSource Creation

alternate text is missing from this package README image

Notes from the original Author

Design

I wanted to ensure that the design of the TreeGridView supported normal TreeView type properties and features, so creating necessary classes to create the “tree view” experience was necessary (see object model for more details).

Custom Painting

Painting an image in a cell is easy, but ensuring that the text from the DataGridViewTextBoxCell didn’t overlap the image took a bit of work. Using the Padding feature of the DataGridViewCellStyle, I add padding to the left side of the cell to account for the text and the indentation. This padding affects the painting and behavior of the text box cell, so editing a text cell correctly positions the editing control.

Siting/Unsiting a node

Since I don’t want to set padding and styling except when a node is actually displayed. When the node is displayed or in the grid, it is sited. When the node is sited I set all the necessary properties.

Unbound

Since expanding and collapsing is based upon dynamically adding and removing rows from the grid, I decided that unbound mode would be the best way to go with this. I’ve hidden the “databinding” properties and the virtual mode property since this doesn’t support those features.

Edit Mode

One thing that I had to deal with is that double-clicking a cell enters edit mode. This double-click occurs regardless of the padding, so double-click on the +- symbol causes the control to enter edit mode. Edit also enters if you single click on a cell that already has focus. So, to deal with this I turn edit mode to be enabled only through programmatic means. I have code to handle the F2 key to enter edit mode. There are other ways to solve this, but I went with the F2 approach.

Object model structure

TreeGridNode
  • Just like a tree view, I wanted to have the concept of a node. I made the nodes class derive from a DataGridViewRow since a node in the list is the same as a row, just with a bit more info.
Here are some properties:
Nodes – Again, like the treeview, a node has children, so there is a Nodes property that returns child nodes. One of the challenges in coding this is to know when a node is actually a row or when it is just a node. A node is a row when it is in the grid, otherwise it is just a node.

IsSited – A node is “sited” when it is contained in the grid as a row. The Sited property is true in this case. There are a set of protected virtual methods on the TreeGridView class (SiteNode and UnSiteNode).

ImageIndex – Image index for the node’s image. Only used when an ImageList is associated with the TreeGridView.

Image – Image associated with the node. Sets or gets the image. When an ImageList is associated with the TreeGridView and an ImageIndex is set then this returns an image from the ImageList. You can set the Image property to an image if you aren’t using an ImageList.

Cells – Returns the cells for the given node. This wasn’t easy to do since accessing the cells for a node (or row) when the node isn’t sited. Using the DataGridView’s CreateCells method I can get the correct cells collection when the node isn’t in the grid.
TreeGridCell/Column

This is a special DataGridView cell that derives from the DataGridViewTextBoxCell. The main thing that this custom cell class does is to customize the cell drawing to make it look like a tree node. That means that it draws the node’s image and the +/- icons and the tree lines. The custom cell also is where a node detects when you click the mouse to expand or collapse a node. NOTE: A lot more work can be done to correctly detect that the mouse is directly over the +/- image. Right now I’m not doing that.

TreeGridView

This class derives from the DataGridView control. Many things are done in this class. Nodes are sited/unsited in the grid as actual rows. Some DataGridView Properties are hidden since they do not apply.

Here are some properties:
VirtualNodes – One of the common things done with a normal TreeView is to dynamically add child nodes when the user is expanding the parent. With the normal TreeView uses add temp child nodes to get the + sign and support expanding, then remove the temp node later. With the VirtualNodes property, the TreeGridView always displays a + sign next to a node, even if the node doesn’t have any children. Then, by handling the Expanding event you can dynamically add child nodes.

ImageList – ImageList associated with the TreeGridView

Nodes – Identifies the root nodes.

ShowLines – Determines if the TreeGridView shows lines between nodes.

CurrentNode – Identifies the node that has focus.
Here are some events:
Expanding – Again, like the treeview, this event occurs before a node is starting to expand. You can add nodes in this event to fill in more details of a child node collection. When the VirtualNodes property is true, the TreeGridView will display the node with a + sign next to it even when it doesn’t have any children. Handling the Expanding event is where you would dynamically add new child nodes.

Expanded – After a node is expanded.

Collapsing – Before a node is being collapsed

Collapsed – After a node has been collapsed.

ToDo

  • Addition of tri-state Checkboxes
  • Themed Checkboxes
  • Themed "+" "-" symbols
  • Addition of user images for Expansion and checkboxes
Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net9.0-windows7.0 is compatible.  net10.0-windows was computed.  net10.0-windows7.0 is compatible. 
.NET Framework net472 is compatible.  net48 is compatible.  net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Krypton.Toolkit.Suite.Extended.TreeGridView.Nightly:

Package Downloads
Krypton.Toolkit.Suite.Extended.Ultimate.Nightly

The Ultimate all-in-one package for Krypton Toolkit Suite Extended. This package includes ALL Extended Toolkit assemblies and dependencies bundled together for maximum convenience. Supports .NET Framework 4.7.2 - 4.8.1, .NET 8 - 10. All libraries are included targeting each specific framework version for performance purposes. This package includes: - All Extended Toolkit controls and components - All shared utilities and tools - All dependencies required for full functionality - Support for all target frameworks Perfect for applications that need the complete Extended Toolkit without managing individual packages. To view all of the extended toolkit package latest version information, please visit: https://github.com/Krypton-Suite/Krypton-Toolkit-Suite-Version-Dashboard/blob/main/Documents/Modules/Extended/Krypton-Toolkit-Suite-Extended-Modules.md

Krypton.Toolkit.Suite.Extended.Ultimate.Lite.Nightly

The Ultimate Lite all-in-one package for Krypton Toolkit Suite Extended. This package includes ALL Extended Toolkit assemblies and dependencies bundled together for maximum convenience. This is the LITE version with reduced framework targets for smaller package size. Supports .NET Framework 4.8 - 4.8.1, .NET 8 - 10. All libraries are included targeting each specific framework version for performance purposes. This package includes: - All Extended Toolkit controls and components - All shared utilities and tools - All dependencies required for full functionality - Support for modern target frameworks (excludes .NET Framework 4.7.2) Perfect for applications targeting modern frameworks that need the complete Extended Toolkit without managing individual packages. Difference from Ultimate package: - Ultimate: Supports net472, net48, net481, net8.0, net9.0, net10.0 - Ultimate.Lite: Supports net48, net481, net8.0, net9.0, net10.0 (excludes net472) To view all of the extended toolkit package latest version information, please visit: https://github.com/Krypton-Suite/Krypton-Toolkit-Suite-Version-Dashboard/blob/main/Documents/Modules/Extended/Krypton-Toolkit-Suite-Extended-Modules.md

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
100.25.11.320-alpha 167 11/16/2025
100.25.11.318-alpha 188 11/14/2025
100.25.11.314-alpha 181 11/10/2025
100.25.10.300-alpha 135 10/27/2025
100.25.10.299-alpha 88 10/26/2025
100.25.10.293-alpha 118 10/20/2025
100.25.10.291-alpha 45 10/18/2025
100.25.10.288-alpha 41 10/18/2025
100.25.10.286-alpha 133 10/13/2025
100.25.9.244-alpha 158 9/1/2025
100.25.8.230-alpha 130 8/18/2025
100.25.7.209-alpha 122 7/28/2025
100.25.7.188-alpha 128 7/7/2025
100.25.5.140-alpha 161 5/20/2025
100.25.4.97-alpha 146 4/7/2025
100.25.3.80-alpha 124 3/21/2025
100.25.2.48-alpha 104 2/17/2025
100.25.2.41-alpha 89 2/10/2025
100.25.2.34-alpha 85 2/3/2025
100.25.1.1-alpha 96 1/1/2025
100.24.12.358-alpha 73 12/23/2024
100.24.12.337-alpha 74 12/2/2024
100.24.12.336-alpha 70 12/2/2024
100.24.11.333-alpha 66 12/2/2024
100.24.11.330-alpha 80 11/25/2024
90.24.10.295-alpha 93 10/21/2024
90.24.9.260-alpha 104 9/16/2024
90.24.8.240-alpha 82 8/27/2024
90.24.8.225-alpha 100 8/12/2024
90.24.7.209-alpha 87 7/27/2024
90.24.7.200-alpha 75 7/18/2024
90.24.6.176-alpha 90 6/24/2024
90.24.6.162-alpha 89 6/10/2024
90.24.5.141-alpha 92 5/20/2024
90.24.5.134-alpha 96 5/13/2024
90.24.4.120-alpha 87 4/29/2024
90.24.4.106-alpha 104 4/15/2024
90.24.4.92-alpha 79 4/1/2024
90.24.3.78-alpha 91 3/18/2024
90.24.2.60-alpha 85 2/29/2024
90.24.2.57-alpha 99 2/26/2024
90.24.2.47-alpha 94 2/16/2024
90.23.11.312-alpha 213 11/8/2023
80.24.2.45-alpha 92 2/14/2024
80.24.2.36-alpha 88 2/5/2024
80.24.1.15-alpha 88 1/15/2024
80.24.1.8-alpha 96 1/8/2024
80.23.12.352-alpha 77 12/18/2023
80.23.12.338-alpha 106 12/4/2023
80.23.10.291-alpha 127 10/18/2023
80.23.10.289-alpha 120 10/16/2023
80.23.9.261-alpha 138 9/18/2023
80.23.9.247-alpha 131 9/4/2023
80.23.7.198-alpha 159 7/17/2023
80.23.6.178-alpha 147 6/27/2023
80.23.6.170-alpha 147 6/19/2023
80.23.6.156-alpha 149 6/5/2023
80.23.5.142-alpha 158 5/22/2023
80.23.5.137-alpha 153 5/17/2023
80.23.5.121-alpha 180 5/1/2023
80.23.4.93-alpha 177 4/3/2023
80.23.3.72-alpha 178 3/13/2023
80.23.3.65-alpha 176 3/6/2023
80.23.2.58-alpha 186 2/27/2023
80.23.2.46-alpha 180 2/15/2023
80.23.2.44-alpha 179 2/13/2023
80.23.2.40-alpha 182 2/9/2023
80.23.2.37-alpha 186 2/6/2023
80.23.1.27-alpha 204 1/27/2023
80.23.1.25-alpha 203 1/25/2023
80.23.1.24-alpha 180 1/24/2023
80.23.1.16-alpha 194 1/16/2023
80.23.1.10-alpha 186 1/10/2023
80.23.1.9-alpha 186 1/9/2023
80.23.1.4-alpha 189 1/4/2023
80.23.1.3-alpha 191 1/3/2023
80.22.12.353-alpha 192 12/19/2022
80.22.12.350-alpha 190 12/16/2022
80.22.12.348-alpha 183 12/14/2022
80.22.12.347-alpha 184 12/13/2022
80.22.12.341-alpha 180 12/7/2022
80.22.12.340-alpha 172 12/6/2022
80.22.12.339-alpha 183 12/5/2022
80.22.12.338-alpha 187 12/4/2022
80.22.12.335-alpha 187 12/1/2022
80.22.11.333-alpha 185 11/29/2022
80.22.11.327-alpha 180 11/23/2022
80.22.11.324-alpha 181 11/20/2022
80.22.11.320-alpha 180 11/16/2022
80.22.11.313-alpha 204 11/9/2022
80.22.11.311-alpha 183 11/7/2022
80.22.11.307-alpha 180 11/3/2022
80.22.11.305-alpha 191 11/1/2022
70.22.10.275-alpha 231 10/2/2022
70.22.9.257-alpha 325 9/14/2022
70.22.9.255-alpha 202 9/12/2022
70.22.9.252-alpha 192 9/9/2022
70.22.9.250-alpha 189 9/7/2022
70.22.9.249-alpha 192 9/6/2022
70.22.8.243-alpha 190 8/31/2022
70.22.8.241-alpha 199 8/29/2022
70.22.8.238-alpha 201 8/26/2022
70.22.8.236-alpha 208 8/24/2022
70.22.8.235-alpha 193 8/23/2022
70.22.8.234-alpha 205 8/22/2022
70.22.8.225-alpha 213 8/13/2022
70.22.8.224-alpha 216 8/12/2022
70.22.8.223-alpha 207 8/11/2022
70.22.8.222-alpha 208 8/10/2022
70.22.8.220-alpha 210 8/8/2022
70.22.8.217-alpha 204 8/5/2022
70.22.8.215-alpha 223 8/3/2022
70.22.8.214-alpha 217 8/2/2022
70.22.8.213-alpha 207 8/1/2022
70.22.7.207-alpha 205 7/26/2022
70.22.7.203-alpha 215 7/22/2022
70.22.7.201-alpha 210 7/20/2022
70.22.7.200-alpha 209 7/19/2022
70.22.7.199-alpha 227 7/18/2022
70.22.7.194-alpha 227 7/13/2022
70.22.7.193-alpha 218 7/12/2022
70.22.7.190-alpha 216 7/9/2022
70.22.7.189-alpha 214 7/8/2022
70.22.7.188-alpha 225 7/7/2022
70.22.7.186-alpha 212 7/5/2022
70.22.7.185-alpha 210 7/4/2022
70.22.7.183-alpha 240 7/2/2022
70.22.7.182-alpha 214 7/1/2022
70.22.6.181-alpha 214 6/30/2022
70.22.6.180-alpha 216 6/29/2022
70.22.6.175-alpha 212 6/24/2022
70.22.6.172-alpha 223 6/21/2022
70.22.6.165-alpha 215 6/14/2022
65.22.5.126-alpha 254 5/6/2022
65.22.5.124-alpha 222 5/4/2022
65.22.4.120-alpha 230 4/30/2022
65.22.4.118-alpha 223 4/28/2022
65.22.4.117-alpha 223 4/27/2022
65.22.4.116-alpha 222 4/26/2022
65.22.4.113-alpha 222 4/23/2022
65.22.4.112-alpha 227 4/22/2022
65.22.4.103-alpha 229 4/13/2022
65.22.4.98-alpha 224 4/8/2022
65.22.4.97-alpha 232 4/7/2022
65.22.4.91-alpha 226 4/1/2022
65.22.3.87-alpha 233 3/28/2022
65.22.3.82-alpha 225 3/23/2022
65.22.3.81-alpha 230 3/22/2022
65.22.3.80-alpha 227 3/21/2022
65.22.3.78-alpha 240 3/19/2022
65.22.3.77-alpha 231 3/18/2022
65.22.3.75-alpha 237 3/16/2022
65.22.3.74-alpha 236 3/15/2022
65.22.3.73-alpha 224 3/14/2022
65.22.3.72-alpha 232 3/13/2022
65.22.3.71-alpha 234 3/12/2022
65.22.3.67-alpha 241 3/8/2022
65.22.3.66-alpha 232 3/7/2022
65.22.3.63-alpha 236 3/4/2022
65.22.2.57-alpha 256 2/26/2022
60.22.2.41-alpha 252 2/10/2022
60.22.2.40-alpha 242 2/9/2022
60.22.2.35-alpha 256 2/4/2022
60.22.1.31-alpha 262 1/31/2022
60.22.1.30-alpha 258 1/30/2022
60.22.1.29-alpha 248 1/29/2022
60.22.1.27-alpha 242 1/27/2022
60.22.1.23-alpha 243 1/23/2022
60.22.1.22-alpha 243 1/22/2022
60.22.1.20-alpha 250 1/20/2022
60.22.1.19-alpha 245 1/19/2022
60.22.1.18-alpha 239 1/18/2022
60.22.1.17-alpha 257 1/17/2022
60.22.1.16-alpha 249 1/16/2022
60.22.1.15-alpha 247 1/15/2022
60.22.1.14-alpha 255 1/14/2022