I have this XAML code
<ListView Name="_lvContacts" ItemsSource="{Binding AccountPhonesList}"
<ListView.View>
<GridView>
<GridViewColumn Header="{Binding Path=ColumnHeader1}" DisplayMemberBinding="{Binding Path=Home}" Width="70" />
<GridViewColumn Header="{Binding Path=ColumnHeader2}" DisplayMemberBinding="{Binding Path=Office}" Width="70" />
<GridViewColumn Header="{Binding Path=ColumnHeader3}" DisplayMemberBinding="{Binding Path=Mobile}" Width="70" />
<GridViewColumn Header="{Binding Path=ColumnHeader4}" DisplayMemberBinding="{Binding Path=Other}" Width="70" />
<GridViewColumn Header="{Binding Path=ColumnHeader5}" DisplayMemberBinding="{Binding Path=Email}" Width="70" />
</GridView>
</ListView.View>
</ListView>
And this is code behind
for (int i = 0; i < _lvContacts.Items.Count; i++)
{
string header = _lvContacts.Items[i].ToString();
MyFunction(header);
}
How can I get the GridViewColumn Header from ListView?I was trying to get GridView from ItemSources but this is already used by collection!I dont know what else I can say about this.
I hope this is understandable.
In your case you can do: