My DataGrid's data source is a List<MyClass>
The problem is the grid shows all the properties, how do I restrict it ti
show only say prop2 and prop10
TIA
David McCallum
Cheers,
Arun
On Dec 3, 6:52 am, "David McCallum"
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);
}
Try setting ICTable.MappingName to the name of the element type, i.e.
DataGridTableStyle ICTable = new DataGridTableStyle {MappingName =
"IC"};
Hope that helps,
Michał
>>Try setting ICTable.MappingName to the name of the element type, i.e.
>>DataGridTableStyle ICTable = new DataGridTableStyle {MappingName ="IC"};
Tried that just get the same results
David
Try this too,
//Do clear default table style before applying customized
ICGrid.TableStyles.Clear();
ICGrid.TableStyles.Add(ICTable);
Hope this helps,
Cheers,
Arun
On Dec 4, 2:23 am, "David McCallum"
>> DataGridTableStyle ICTable = new DataGridTableStyle();
>> ICTable.MappingName = ICGrid.DataSource.GetType().Name;
Thanks that did it, finny thing is I expected
ICGrid.DataSource.GetType().Name to return List, List<T>, List<IC> or
something like that. Instead it returns List`1
Any ideas?
David
"Arun" <arunkuma...@gmail.com> wrote in message
news:94c5053e-cf36-4d1f...@t39g2000prh.googlegroups.com...