I have a programmatically created, dynamic DataGrid (.NET 4, WPF). Its header columns are resizeable and movable. Further, I have a kind of a ruler control which has some marks which have to move (and point exactly to the column middle) when the columns are moving.
I am observing the DataGrid's ColumnReordering and SizeChanged events, and want to provide the exact information on the each column's dimensions and starting position in relation to the left edge of the datagrid control. Is there a way to get the particular columns' offset in the control?
Just summing up widthes of all previous columns is not enough - the sum of column widthes is less then the total control width (by 1px*number of columns as for now). Probably coming out due to some separator lines, etc between the columns, which could probably change if the designer would later change styles. I could probably figure out the separator width from this discrepancy, and use this value in a position calculation formula, but if a ready, control-provided method would be there, I would of course prefer to use this.