Arun,
Thanks for that, but I already tried that from an example I found. Can you have a look at my code and see if you see anything wrong. The two properties I want to display are FullIC and IcDescription, but as can be seen my the image all the columsn still show.
TIA
David
public ICSelector(List<IC> ics)
{
InitializeComponent();
ICGrid.DataSource = ics;
this.ics = ics;
// Creates two DataGridTableStyle objects, one for the Machine
// array, and one for the Parts ArrayList.
DataGridTableStyle ICTable = new DataGridTableStyle {MappingName = "List<IC>"};
// Sets the MappingName to the class name plus brackets.
// Creates three column styles.
var colFullIC = new DataGridTextBoxColumn();
// Property ic.FullIC
colFullIC.MappingName = "FullIC";
colFullIC.HeaderText = "IC";
DataGridTextBoxColumn colDescription = new DataGridTextBoxColumn();
// Property ic.IcDescription
colDescription.MappingName = "IcDescription";
colDescription.HeaderText = "Description";
// Adds the column styles to the grid table style.
ICTable.GridColumnStyles.Add(colFullIC);
ICTable.GridColumnStyles.Add(colDescription);
// Add the table style to the collection, but clear the
// collection first.
ICGrid.TableStyles.Clear();
ICGrid.TableStyles.Add(ICTable);
}
ICSelector.jpg
38KViewDownload