Is there any predefined event that gets triggered when user changes the column width in xamdatagrid?
In this case, you can subscribe for this event after the XamDataGrid is loaded. You can do this in the XamDataGrid - Loaded event and use EventManager.RegisterClassHandler(...) method. This way, you will be able to handle SizeChanged after the LabelPresenters have been loaded. You can do this using the following code:
xamDataGrid1.Loaded += new RoutedEventHandler(xamDataGrid1_Loaded);
...
Thanks. Then my next question is, is it possible to differentiate initial load from width being chagned by user?
Hello,
Currently, there is no such event in the XamDataGrid. You may want to submit a feature request for this here.
However, you can use the LabelPresenter's SizeChanged event. Please note that this event will also fire when the LabelPresenter are loaded.
<Style TargetType="{x:Type igDP:LabelPresenter}">
<EventSetter Event="SizeChanged" Handler="lb_SizeChanged"/>
</Style>
void lb_SizeChanged(object sender, SizeChangedEventArgs e)
{
}