I'm making a hierarchical grid from list of my own business objects, call them Parent and Child. Parent has a List<Child> ChildCollection property. I can bind this to the grid with SetDataBinding(listOfParents, string.Empty, true) and I get all my data, nice and hierarchical-like.
While I can control Band0 pretty well (I can specify columns and the header color), I don't seem to have any control over Band1. I've set up columns/colors in the designer, but at runtime I get a default layout of all of Child's properties and the default colors. I've tried setting grid.DisplayLayout.NewColumnLoadStyle = None, but this results in Band1 having no columns at all.
How can I control Band1 better?
Hi,
Maybe one possible solution could be if you handle ultraGrid1_InitializeLayout event. Please take a look on attached sample for more details and if you have any questions, feel free to write me
Regards
Here is the sample
Ok, I can do it through code. Is there any way I can do this from the designer?
In scenario, when you define your own schema, your child band should have a key with the same name like your List<> property.
public class Document
{
#region Properties
...
private List<DocumentInfo> documentInfoList;
public List<DocumentInfo> DocumentInfoList
get { return documentInfoList; }
set { documentInfoList = value; }
}
public class DocumentInfo
In my sample I have I should use for a child band the key - DocumentInfoList
Let me know if you have any questions.
Ah, ok. That answers my next question, which was "how do I specify which band is for which object". I didn't see the .Key property.
Now, how exactly does the grid discover a child collection? Do I have to name my child collections a certain way?
Here is the new sample
Yes, you could define your data schema. Please take a look on attached sample and video file how to do that.