I have a custom property descriptor that I use to support flattening object hierarchies.
To accomplish this I subclassed PropertyDescriptor and I store a linked list to the ‘next’ (child) property that I want to retrieve the value for.
This enables me to bind subproperties to a grid(export to excel, whatever) in a ‘flat’ manner.
eg. Grid(bound Property, Caption)
Col1:Customer.Name(Customer) Col2:Customer.Address(Address) Col3:Customer.OutstandingOrders.Count(Outstanding Orders)
The problem is that once I add in a column with a duplicate name, regardless of the fact it’s got a unique caption it will retrieve the property for the 1st one but still put the correct header in:
Col4:Customer.Company.Name(Company)
Any ideas?
Can you clarify that line? I’ve done this before, but I used the navigation path in the imaginary name – i.e. I might have the
PropertyDescriptor.NamereportCustomer_Company_Namerather thanName, and use the.DisplayNameto report something more readable.