Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
How to Get column Width ?
posted

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.

Parents
  • 69832
    Offline posted

    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;
    }

Reply Children