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
150
Recursive Relationship Layout
posted

I have an object that has a property containing a list of the same object type, and a property of a list of different object types.  Only one or neither will be set at the same time.  This gives me a jagged hierarchy, where each object can be nested an arbitrary number of times, with ultimately some having children of different objects.

Here is an example:

class Foo

{

    string Name { get; set; }

    List<Foo> Foos { get; set; }

    List<Bar> Bars { get; set; }

}

 

class Bar

{

    string Name { get; set; }

}

 A possible output would be:

Foo 1

  Foo 1.1

    Foo 1.1.1

      Bar 1.1.1.2

    Foo 1.1.2

  Foo 1.2

    Bar 1.2.1

Foo 2

...

 How can I represent this in my datasource / band settings?

Thank you

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    I'm not sure if this kind of layout is possible with the WinGrid. The problem is that the grid gets the data structure from the BindingManager up front, and the BindingManager will base the structure on the current row - which will likely be the first row.

    Lists here return an empty list when there are no items, it might work. But if either of the list properties returns Null, then the BindingManager will be unable to get a data structure for anything beneath that level. If your list properties return empty lists, then it may or may not work, I'm not really sure. You might have a problem a few levels down.

    One thing you could do is use UltraWinTree instead of UltraWinGrid. The tree gets the data structure lazily, so it will probably work better in terms of displaying the hierarchy and getting the correct data structures.The tree lacks some of the features of the grid, though, such as filtering and summaries.

Children
No Data