I have a List<Data> where:
class Data
{
public string Name { get; set; }
}
and I use this list as the ItemsSource of a ListView.
The View of my ListView is a GridView with one GridViewColumn (iniltially) and I bind the property Data.Name using the DisplayMemberBinding of my GridViewColumn.
At run-time may happen that I add a new GridViewColumn to my GridView, so i need to bind a new property of Data to this new column.
How can I do this?
No, you can’t add “regular” properties at runtime – frankly, for what you describe might want to bind to a DataTable, and map the data in. You can do this at runtime but it is pretty complex. DataTable has a full implementation already.