0

To get a column of a ListView in WPF we can do

((GridView) someListView.View).Columns[index] 

But how to get a GridViewColumn knowing only the name of its header?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Limbo Exile
  • 1,321
  • 2
  • 21
  • 41

1 Answers1

1

You should try this: ((GridView) _lvContacts.View).Columns.FirstOrDefault(x => (string) x.Header == "Name"); Of course, you have to be sure the column's header is only a string (just like in your sample code).

MDoobie
  • 272
  • 2
  • 10