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
210
Position of column in pixels
posted

Hi,

I allow users to rearrange the columns in the grid, but need to format the rest of the screen around the current position of one of the columns,  is there any way to find out exactly how many pixels the column is from the left edge of the Grid?

I can get the width of a column in the grid and it's OriginX & SpanX values from RowLayoutColumnInfo, but I can't find the Origin in terms of pixels.

Thanks

Andy

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    As long as the column is actually visible within the viewable area of the grid, you can get the location using UIElements.
                UIElement element = this.ultraGrid1.DisplayLayout.Bands[0].Columns["String 1"].Header.GetUIElement();
                if (element != null)
                    Debug.WriteLine(element.Rect);

    If you are not showing column headers, you might want to use a cell instead. In which case you just get any cell in the column and call GetUIElement on it, instead of the column header like I am doing here.

     

Children