How to accomodate ultratree control inside a ultragrid cell column
If you have NetAdvantage 2009 volume 2, you could do this using the new UltraControlContainer editor. Although, I probably would not recommend it unless the tree is pretty simple, since this would be quite a lot of overhead and might affect performance.
In any previous version, there's really no way to embed a control in a grid cell - unless you mean you want to do it as a dropdown and not embedded in the cell itself.
Hi,
Sorry for hi-jacking this post but I too am embedding an ultratree in a cell and am doing this via the UltraControlContainer. I just have a question... how do I get the cell height to accomdate the UltraTree? Is there an autosize feature at all?
Thanks
Ryan
Hi Ryan,
Okay.. here's how it works....
There's a method on the grid row call PerformAutoSize which will autosize the row to it's contents. The row also auto-adjusts it's height initially, I think, depending on the RowSizing setting.
Anyway, when the row determines it's size, it has to ask the editor in each cell in the row for the appropriate height. The grid doesn't know what's displaying in the cell, necessarily, because the editor handles that. So it's the editor that has to calculate the automatic size.
In the case of the ControlContainerEditor, it doesn't know what it's displaying, either, since it can contain any control. So what it does is use the PreferredSize property on the RenderingControl, if possible.
In this case, the WinTree's PreferredSize isn't going to do anything, because the tree doesn't override PreferredSize or do any automatic sizing. So what you would have to do is derive your own control and override the GetPreferredSize method. You could derive a control from the tree and do this. Or you could derive from a Panel and then use a tree inside that panel for your ControlContainerEditor.