Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
330
Can't bind BindingSource from a complex object to an UltraWinGrid
posted

I have a Business object "Parent" that has a collection of another Business object called "Child". It also has some properties and methods as usual. Now this is how i try to bind this to an UltraWinGrid:

1. Populate "Parent" instance called "p" by assigning some values to its properties.

2. Declare a Bindingsource "bndSource" at runtime.

3. Set binding source DataSource as bndSource.DataSource = p;

4. Set binding source of ultrawingrid to be mygrid.Datasource = bndSource.

5. Run.

As control passed through step 4, the entire form goes white in color and does nothing until I abruptly end the process. 

Note: The "Parent" class has some properties (some readonly, some are of datatype guid, some are inherited), some methods and a collection of objects of type "child".

Note: This class is generated using Nettiers templates.

 

  • 469350
    Verified Answer
    Offline posted

    Hi,

    The grid needs to be bound to an IList or an IBindingList. So are you binding the grid to a list of Parent objects, or a single object? I don't think a single parent object will work, but you could create a BindingList<Parent>, add a single parent object to the list and bind the grid to that.

    Having said that, I'm not sure why the whole form locks up. Binding the grid to a single object should not cause that. That's more likely to happen if you bind the grid to a recursive data source. Does your Child object also have a collection of Child objects? If so, then you probably need to limit the grid's depth. Try setting MaxBandDepth on the grid.DisplayLayout to something like 5 and see if that fixes the issue.