I'm using an UltraTree in Outlook express mode, with no automatic size for column. I can't find a way to get width for each colum.
I have noticed that Layout Info is not always updated.
Sorry, I should have mentioned that code will only work if the header is within the viewable area of the screen.
Hi Brian,
I'm using this bit of workaround code you provided for getting the column widths but I cant seem to get it working correctly. When I pass my column object into the GetDescendat method it just returns the headerElement as null, is there a way of retrieving a collection of all the columnheaderUIElements and then manually searching through them for the correct one?
Thanks,
Denis
The PreferredCellSize/PreferredLabelSize properties of UltraTreeLayoutInfo return 0 for the width/height components when they are not set explicitly (It think that is what you mean by "not always updated"). If you like you can visit http://devcenter.infragistics.com/Protected/RequestFeature.aspx and submit a request for resolved versions of these properties; in the meantime, the following workaround will give you the column width by finding the associated UIElements:
private int GetColumnWidth( UltraTreeNodeColumn column ){ UltraTree treeControl = column != null ? column.Control : null; UltraTreeUIElement controlElement = treeControl != null ? treeControl.UIElement : null;
if ( controlElement != null ) { UltraTreeNodeColumnHeaderUIElement headerElement = controlElement.GetDescendant( typeof(UltraTreeNodeColumnHeaderUIElement), column ) as UltraTreeNodeColumnHeaderUIElement;
if ( headerElement != null ) return headerElement.Rect.Width; }
return 0;}