Hello,
I have a list of objects that needs to be bound to a grid. However, the default "behavior" is not what I need right now.
My object DataItem contains descriptive properties, and then a collection of 2 different DataSourceItems. By default these DataSourceItems appears as a child of the DataItem in the grid. What I would like to see is the properties of these 2 items appear in the same row as the DataItem which is bound to the grid, not as children.
Simplified object structure is as follows:
class DataItem
{
public int id { get; set; }
public List<DataSourceItem> List { get; set }
}
class DataSourceItem
public string Name { get; set; }
public string Value { get; set; }
Any suggestions would be great, let me know if this is overly vague.
To achieve this you would have to use UnboundFields which can work with indexers.
You should use the BindingPath property of the UnboundField and set it to something like:
BindingPath="PropertyName[index].PropertyName"
example : BindingPath="List[X].Name"
In addition to this, please make sure that the AutoGenerateFields property of the FieldLayoutSettings is set to false and you define the field layouts manually.