I am binding an arraylist of objects (class Invoice) This works fine and
binds all the public properties to the datagrid.
However, I only want to show *some* properties e.g. No, Detail and
TotalValue -- not all the public props.
After I call my gridSummary.DataSource = invoiceList;
then I create a new GridTableStyle and add some mappings, clear the existing
TableStyles then Add my new table style
*Nothing happens*... any ideas ?
Sample code:
DataGridTableStyle ts = new DataGridTableStyle();
ts.MappingName = "InvoiceList";
DataGridTextBoxColumn cs = new DataGridTextBoxColumn();
cs.MappingName = "Num"; // Public property name
cs.HeaderText = "Num";
cs.Format = "f4";
cs.Width = colwidth;
ts.GridColumnStyles.Add(cs);
cs = new DataGridTextBoxColumn();
cs.MappingName = "Detail"; // Public property name
cs.HeaderText = "Detail";
cs.Width = colwidth;
ts.GridColumnStyles.Add(cs);
// Add the custom tablestyle to the DataGrid
InvoiceSummary.TableStyles.Clear();
InvoiceSummary.TableStyles.Add(ts);
Adam - 10 Oct 2004 15:14 GMT
Sorted it.
Invoices collection was returning an Invoice[] which is an Array type
Changed to return an ArrayList which is a collection and appears to work
> I am binding an arraylist of objects (class Invoice) This works fine and
> binds all the public properties to the datagrid.
[quoted text clipped - 42 lines]
>
> InvoiceSummary.TableStyles.Add(ts);