I have a OrderItem object that has a Product property and I want to show nested properties like Product.Id, Product.Name and so on in a GridGroupingControl.
I defined the column this way:
new GridColumnDescriptor(new FieldDescriptor("Product", "Product.Description", false, ""), "Description")
If I do so only the class name (Product.ToString() output) is displayed.
With the existing code this is not supported at the moment. But we consider this a pretty important feature and should soon have something working.
GSGünter SchwaigerJune 2, 2004 03:54 AM UTC
Thank you. Now I have to start at the beginning. Do you know a way to display a class hirarchy with different headers for each child element and +/- for (un)collapsing the tree? We use only objects to hold our order informations.
AdministratorJune 2, 2004 10:30 AM UTC
When you say different headers. Do you mean different fields to be displayed or do you just want to change the header text?
I mean, if you do have that collection with nested objects, are the nested objects all of the same type with same columns and you only want to display different column headers or is it different columns for each object?
Regarding support for nested properties:
I can get back to you once we have support for the nested properties working. This should be available with a patch in a couple of weeks.
One way to work around this limitation with grouping grid could be in the meantime to implement wrapper class derived from IEditableObject that exposes the nested properties as public properties. In the public property implementations you could then get and set the value from your underlying object. See the StrongTypedCollection example how to implement IEditableObject.
GSGünter SchwaigerJune 2, 2004 12:23 PM UTC
Thank you. What we want to display in the grid is a Order with a collection of OrderItem. An OrderItem can hold a single Product or a Package (Collection of Protuct). So the OrderItems should have a different header as the list of Product in it. All this classes implent the IEditableObject interface.
I defined all the relations in GridGroupingControl and this object tree with it different headers are shown correctly, but the nested properties did not work (not implemented yet).
There is not enough time to write wrapper classes, I think we try to save the objects in XML and load it in a DataView. Any better idea?
AdministratorJune 2, 2004 01:10 PM UTC
I think creating a DataView should be the easiest.