This is a migrated thread and some comments may be shown as answers.

Bug - ColumnWidthChanged has incorrect values.

1 Answer 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 01 Apr 2011, 03:28 PM
In the ColumnWidthChangedEventArgs object received by the ColumnWidthChanged event the "e.NewValue" does not contain the complete new column settings.  In particular, I am trying to get the pixel size of the column that has been set to "Auto" by double clicking the drag handle.

1 Answer, 1 is accepted

Sort by
0
Tsvyatko
Telerik team
answered on 05 Apr 2011, 12:19 PM
Hi Rob,

 

ColumnWidthChanged is fired once user tries to resize or double click on the resizer. As you have found out it contains information about the original and the current column width. When user resizes  the column using drag the current width can be measured in absolute units (pixels). However, if the user double-clicks the width become auto (fit to contents) and thus it cannot be measured in absolute units until the measures finishes.

If we need to acquire the absolute width of the column after the measure is complete I can suggest using code similar to the one below:

if(e.NewWidth.IsAuto)
{
      this.radGridView.Dispatcher.BeginInvoke((Action)(()=>YourMethodHere(e.Column.ActualWidth)));
}


All the best,
Tsvyatko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Rob
Top achievements
Rank 1
Answers by
Tsvyatko
Telerik team
Share this question
or