Hi,
How can I get the new position of a column that is being moved to and the existing position? The help says something strange:
"The VisiblePosition property can be used to determine both the current and the new positions of the column or columns that will be moved or swapped. New positions can be determined by reading the property off of the header of the column or columns in columns, while current positions can be determined by reading the property off of the header of the column or columns in the appropriate band."
However there isn't columns property in BeforeColPosChangedEventArgs class. Could you drop an example of this?
Thanks,
Vitaly
Hi Vitaly,
I assume they mean the e.ColumnHeaders param will return the new VisiblePositions, whereas the VisiblePosition of the column.Header on the grid band will reutrn the original (current) positions.
Hi Mike,
I've checked and the grid works exactly as you described. However not when I set Band.UseRowLayout to true. VisiblePosition properties of both ColumnHeaders and column of the Band is not changed at all.
In such case the OriginX property of ColunmHeaders is changed . But as we may expect the OriginX of the column.RowLayoutColumnInfo on the grid band is also changed because these two references points the same object.
Do you have any idea how to get the old OriginX of the column?
Actually I've found the solution but I'm not sure it's the best one.
The grid column's properties OriginX, OriginY etc can be initialized via the RowLayout object that can be added to a band. In the BeforeColMove event handler the ColumnsHeaders.Column.RowLayoutColumnInfo will contain new values of OriginX, OriginY, etc properties and the RowLayout object's properties will still contain old values.
That sounds good to me.