public ColumnHeaderListener(DataGrid dataGrid) { this.dataGrid = dataGrid; dataGrid.Columns.CollectionChanged += this.OnCollectionChanged; var headers = dataGrid.GetColumnHeadersSource() as INotifyCollectionChanged; if (headers != null) { headers.CollectionChanged += this.OnCollectionChanged; } }