Good afternoon.
Give, please, a code example, how to realize hierarchical datasource as a collection.
I attach a project that should work according to the instructions, but don't work correctly.
Hi,
I ran your sample project and it works just fine for me. My guess is that you just need to get the latest service release.
How to get the latest service release - Infragistics Community
In any case, I don't recommend using List<T> or binding the grid to an array like you are doing here. If you bind the grid to an Array or a List<T>, then you are using the IList interface, which is not a robust interface for data binding. You will have limited functionality in the grid if you use ILists.
I recommend using BindingList<T>, instead.
private void Form1_Load(object sender, EventArgs e) { A a = new A {Id = 1}; B b = new B {Name = "b1", ParId = 1}; a.Coll = new BindingList<B>{b}; ultraGrid1.DataSource = new BindingList<A> { a }; B b2 =new B{Name = "b2", ParId = 1}; B b3 = new B { Name = "b3", ParId = 1 }; a.Coll.Add(b2); a.Coll.Add(b3); } public class B { public int ParId { get; set; } public string Name { get; set; } } public class A { public int Id { get; set; } public BindingList<B> Coll { get; set; } }
If you do that, it might work without the service release.
Thanks for the Suggestion
Mike,
thanks for the quick reply.
My problem is: if I add a field to the "B" class, then an excess column appears in the grid, though I don't want it to appear. Changing List to BindingList doesn't help here.
How to improve the situation?