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
2549
Inserting columns in an UltraGrid when RowLayoutStyle = ColumnLayout causes "overlapping"
posted

Hi all,
I have written an extender for the UltraGrid in order to validate some data for our company.
The extender inserts columns into the grid providing an index and a key, nothing special so far.

When I attach the extender to a default grid everything works fine.

Now when RowLayoutStyle of the grid is set to ColumnLayout the inserted columns seem to get merged/overlapped with the existing column at the index-position where the column was inserted.
It seems to replace the column at the specific index.

I figured out that this has something to do with the RowLayout / RowLayoutColumnInfo from the original column beeing applied to the inserted column, but somehow I can not sort it out any further.
Inserting at the end works, but it is unfortunately not an option.

How can I insert a column when ColumnLayout is active? Is there a way to add new Columns together with RowLayoutInfo or something like this?
How can this be done in a "nice, programmatical way"?

Any hints are kindly appreciated,
best regards
Andy

  • 469350
    Verified Answer
    Offline posted

    Hi Andy,

    It's hard to say what's happening here without seeing what code you are using to insert the column and what your ColumnLayout looks like.

    Basically, the way ColumnLayouts work is that if a column has RowLayoutColumnInfo settings like OriginX and OriginY, these settings determine the position of the column and the Header.VisiblePosition has no effect. The VisiblePosition is overridden by the ColumnLayout.

    So I suspect that your insert code is setting the VisiblePosition on the column, but it really needs to set the RowLayoutColumnInfo properties like OriginX, OriginY, SpanX, and SpanY.

    What you set these to is too complicated to explain in a forum post, but you might want to search around for some information on the concept of a GridBagLayout and how these properties work. Or take a look at the existing RowLayoutColumnInfo properties on the existing columns. OriginX and OriginY are pretty intuitive once you get the general sense of how they work.