Alex Rivera | Logout

WPF Toolkit DataGrid column resize event

Asked 2010-10-25T15:59:21.767
14

I am using WPF Toolkit Datagrid in one of the applications I am working on. What I want is to store the column width and displayindex as a user preference. I have achived it for column displayindex but for resize I could not find any event on the datagrid which will trigger after column size change. I have tried the "SizeChanged" event which I guess is only fired when it is initially calculating the size and that too is for the whole datagrid and not for the individual columns.
Any alternate solution or if anybody knows about the event ?

Edit
Report

1 Answer

1

LayoutUpdated?

I'm working in Silverlight, and the grid is rebound/refreshed every second.

I'm using the LayoutUpdated method, which fires for every layout updating event.

You could keep a dictionary of the column widths and check for deltas. Then you would know which column(s) had changed.

foreach (DataGridColumn column in dataGrid1.Columns)
{
    // check for changes...
    // save the column.Width property to a dictionary...
}
answered 2012-10-03T16:29:08.680

Your Answer