This question is locked. New answers and comments are not allowed.
Given the following class types
public class Stuff
{
public bool IsSelected {get; set;}
public string School {get; set;}
}
public class Person
{
public string FName {get; set;}
public string LName {get; set;}
public object Data {get; set;} // an instance of Stuff will be assigned here.
}
1. I am binding to a collection of persons.
2. I have no templates defined for my columns. I will auto generate columns.
3. I need the grid to display the following columns
IsSelected, School, FName, LName
So I need to be able to dynamically add the columns, set there binding and types so that the user can check/uncheck IsSelected. However, I can add the column but only the text "False" shows as the value. Here's how I add the column. Certainly, I'm missing some pieces. Any ideas?
GridViewDataColumn gvdc2 = new GridViewDataColumn();
gvdc2.DataMemberBinding = new System.Windows.Data.Binding("Data.IsSelected");
gvdc2.DisplayIndex = 2;
SearchResultsGrid.Columns.Add(gvdc2);
public class Stuff
{
public bool IsSelected {get; set;}
public string School {get; set;}
}
public class Person
{
public string FName {get; set;}
public string LName {get; set;}
public object Data {get; set;} // an instance of Stuff will be assigned here.
}
1. I am binding to a collection of persons.
2. I have no templates defined for my columns. I will auto generate columns.
3. I need the grid to display the following columns
IsSelected, School, FName, LName
So I need to be able to dynamically add the columns, set there binding and types so that the user can check/uncheck IsSelected. However, I can add the column but only the text "False" shows as the value. Here's how I add the column. Certainly, I'm missing some pieces. Any ideas?
GridViewDataColumn gvdc2 = new GridViewDataColumn();
gvdc2.DataMemberBinding = new System.Windows.Data.Binding("Data.IsSelected");
gvdc2.DisplayIndex = 2;
SearchResultsGrid.Columns.Add(gvdc2);