How to get the Column index or Column.DisplayIndex from its Column Header in WPF DataGrid?
Column
Column.DisplayIndex
Column Header
WPF
DataGrid
I know th
you could use DisplayIndex (be aware this will change if columns are resorted)
DisplayIndex
var index = dataGrid.Columns.Single(c => c.Header.ToString() == "HeaderName").DisplayIndex;
edited: thanks for suggestion from @AnHX