Todays update to DotNetBar includes ability for AdvTree control to host DotNetBar Items in cells. While cells can host any Windows Forms controls already, controls are fairly “heavy” and resource intensive. DotNetBar items are light-weight and super fast and so are great alternative to use instead of controls whenever possible.
Here is how to host items in cells:
Select AdvTree Node and go to Cells collection.
Click … collection edit button to show collection editor, then click Add to create new cell that will host an item:
Select newly created Cell and then select its HostedItem property:
Show item creation popup and select item that you want to host in cell:
And that’s it.
There is a small limitation to item hosting. You cannot host items that directly show popups. You can however assign content menus to such items and show popups that way if needed.
Here is also small sample project that shows this in action:
Looks really cool. I will definitely be trying this out. This would be really cool in a listView as well… 😀
Indeed.
Is this limited to a sub-set of DotNetBar controls, or can other DotNetBar controls such as ComboBoxEx be hosted (lightweight) as well?
You can host any Windows Forms control already through HostedControl property. This adds hosting for light-weight items. The ComboBoxEx is still Windows Forms control, even if you use ComboBoxItem which is just wrapper around ComboBoxEx.
Ok, that’s what I expected. I’m just trying to determine which of the DotNetBar controls are ‘lightweight’. I assume only the ones listed in the HostedItem dropdown are lightweight: Button, Checkbox, Slider, Rating, ProgressBar, Container. Am I correct in saying these are the lightweight controls, and all other DotNetBar controls are not lightweight?
Anything that is derived from BaseItem except ControlContainerItem, ComboBoxItem and TextBoxItem is light-weight i.e. they don’t have Window handle associated and are not expensive to create and paint as controls that are derived from System.Windows.Forms.Control class. The controls listed in drop-down for HostedItem are the ones that we thought are the ones that make sense using in tree.