G
Guest
I've got a custom collection called CurrencySummaryTransactionCollection
which is a collection of CurrencySummaryTransaction objects. Each of these
objects has a nested TransactionSummary member called Transactions. I don't
want the DataGrid to display these nested transactions so I've implemented
ITypedList and skipped the Transaction property like this
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[]
listAccessors)
{
Type typeOfObject = null;
if( listAccessors==null || listAccessors.Length==0 )
{
typeOfObject = typeof(CurrencyTransactionSummary);
}
else
{
typeOfObject = typeof(CurrencyTransactionSummary);
}
return GetPropertyDescriptors(typeOfObject);
}
private PropertyDescriptorCollection GetPropertyDescriptors(Type
typeOfObject)
{
PropertyDescriptorCollection typePropertiesCollection =
TypeDescriptor.GetProperties(typeOfObject);
ArrayList propertyDescriptorsToUse = new ArrayList();
foreach(PropertyDescriptor property in typePropertiesCollection)
{
if(property.Name == "Transactions")
{
// Don't display this.
}
else
{
propertyDescriptorsToUse.Add(property);
}
}
return new PropertyDescriptorCollection((PropertyDescriptor[])
PropertyDescriptorsToUse.ToArray(typeof(PropertyDescriptor)));
}
However my GridStyle simply isn't applied. Am I missing something fundamental?
which is a collection of CurrencySummaryTransaction objects. Each of these
objects has a nested TransactionSummary member called Transactions. I don't
want the DataGrid to display these nested transactions so I've implemented
ITypedList and skipped the Transaction property like this
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[]
listAccessors)
{
Type typeOfObject = null;
if( listAccessors==null || listAccessors.Length==0 )
{
typeOfObject = typeof(CurrencyTransactionSummary);
}
else
{
typeOfObject = typeof(CurrencyTransactionSummary);
}
return GetPropertyDescriptors(typeOfObject);
}
private PropertyDescriptorCollection GetPropertyDescriptors(Type
typeOfObject)
{
PropertyDescriptorCollection typePropertiesCollection =
TypeDescriptor.GetProperties(typeOfObject);
ArrayList propertyDescriptorsToUse = new ArrayList();
foreach(PropertyDescriptor property in typePropertiesCollection)
{
if(property.Name == "Transactions")
{
// Don't display this.
}
else
{
propertyDescriptorsToUse.Add(property);
}
}
return new PropertyDescriptorCollection((PropertyDescriptor[])
PropertyDescriptorsToUse.ToArray(typeof(PropertyDescriptor)));
}
However my GridStyle simply isn't applied. Am I missing something fundamental?