TreeView or DataGridView ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • colin

    TreeView or DataGridView ?

    Hi,
    I wish to display and edit 3 collections of different object types,
    each object type also has a collection of the other 2 types,
    such that if one object contains another then the reverse
    is always true, a many to many relationship.

    the objects are 3d objects making up a wire mesh model,
    points,wire,sur faces.

    im not sure wich is the best way to go,
    it kind of needs a tree structure,
    but it also has a datagrid type of structure too,
    so is it a tree of grids or a grid of trees?

    obviously the whole thing is totally recursive,
    so the depth would be limited to something sensible like 3,
    this kinda makes it more grid like.

    The rest of the application ive done with
    3d wireframe view/editing with XNA,
    but im new to this sort of advanced control,
    ive made my own tree/dir structure before,
    but long long ago when the controls were rather limited,
    (win3.1) lol.

    have things move on much more?
    Im trying to get to grips with the databinding,
    but failing miserable, is it limited to text only data?
    ive looked at a few tutorials and samples,
    but its hard to see if they can be expanded,
    can you have another datagrid inside another ?
    maybe I should just make my own again.

    for each item in the list I need to be able display the list of items in it,
    preferably in another grid view below it wich is indented,
    a bit like the visual ide does with data in the debuger but
    wich doesnt stack up on top of each other or disapear when you move the
    mouse away.

    some objects have upto 4 3d vectors wich is 12 numbers
    plus I need to be able to set some flags and highlight things etc.

    Any helpfull ideas tutorials,examp les greatly appreciated :)

    thanks
    Colin =^.^=


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: TreeView or DataGridView ?

    Colin,

    It seems like you really want to have something like a combination of a
    tree view control with a grid control, not one or the other.

    You could get a third party grid which supports heiarchical data
    displays, but I think there is a better alternative.

    I suggest you use a TreeView in Windows Presentation Foundation, and
    then use composition to display the extra bits of data for the items in the
    tree.

    As a matter of fact, the ATC Avalon team has a good sample:



    Which Chris Sells goes into further detail at:




    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "colin" <colin.rowe1@nt world.NOSPAM.co mwrote in message
    news:fOZ3j.38$H c3.27@newsfe1-gui.ntli.net...
    Hi,
    I wish to display and edit 3 collections of different object types,
    each object type also has a collection of the other 2 types,
    such that if one object contains another then the reverse
    is always true, a many to many relationship.
    >
    the objects are 3d objects making up a wire mesh model,
    points,wire,sur faces.
    >
    im not sure wich is the best way to go,
    it kind of needs a tree structure,
    but it also has a datagrid type of structure too,
    so is it a tree of grids or a grid of trees?
    >
    obviously the whole thing is totally recursive,
    so the depth would be limited to something sensible like 3,
    this kinda makes it more grid like.
    >
    The rest of the application ive done with
    3d wireframe view/editing with XNA,
    but im new to this sort of advanced control,
    ive made my own tree/dir structure before,
    but long long ago when the controls were rather limited,
    (win3.1) lol.
    >
    have things move on much more?
    Im trying to get to grips with the databinding,
    but failing miserable, is it limited to text only data?
    ive looked at a few tutorials and samples,
    but its hard to see if they can be expanded,
    can you have another datagrid inside another ?
    maybe I should just make my own again.
    >
    for each item in the list I need to be able display the list of items in
    it,
    preferably in another grid view below it wich is indented,
    a bit like the visual ide does with data in the debuger but
    wich doesnt stack up on top of each other or disapear when you move the
    mouse away.
    >
    some objects have upto 4 3d vectors wich is 12 numbers
    plus I need to be able to set some flags and highlight things etc.
    >
    Any helpfull ideas tutorials,examp les greatly appreciated :)
    >
    thanks
    Colin =^.^=
    >

    Comment

    • Peter Duniho

      #3
      Re: TreeView or DataGridView ?

      On 2007-11-30 13:18:51 -0800, "colin" <colin.rowe1@nt world.NOSPAM.co msaid:
      thanks,
      im looking at those and its quite usefull information.
      most of those ilustrations look like either trees or grids though.
      >
      it is much more than a tree, and the usefull depth of nesting is quite
      limited,
      but its also a bit more than a grid,
      what I realy need is a grid with sub grids,
      I haven't tried it, but it seems like you could use the
      TableLayoutPane l, which has a grid-like paradigm, where you put a whole
      TableLayoutPane l into a cell of another TableLayoutPane l.

      As you say, you don't want to go too deep, otherwise you don't have
      room to display everything. But that's an issue anyway.

      Now, all that said, I'm wondering if this "nested grid" idea is really
      the best way to display the data anyway. If it's for your own use, I
      suppose you can do whatever UI you like best. But IMHO anything for
      broader use needs to consider what's easy to use, and I'm not sure a
      nested grid is an easily-understood concept, especially if there are
      circular connections in multiple dimensions within the grid (as it
      sounds as though there are).

      I think that something more like an "inspector" UI would work better.
      One possibility would be to allow arbitrarily many windows, each
      representing a single object, to be open. Then you'd just double-click
      on a reference within an object to open a new window showing you that
      referenced object. Obviously you'd also have to have some way to show
      the top-level collections. That could be a single window with a
      TreeView containing three root nodes, one root for each type of object,
      or one window for each type of object, or whatever.

      Alternatively, you might just have three windows, one for each
      collection. Within a window you would be able to expand a single
      object to show its contents (so a TreeView or similar). But
      double-clicking a referenced object of another type would select that
      instance in the window corresponding to that type, rather than showing
      the data in the owning object's window.

      As a third alternative, if you feel that the relationships between the
      objects really need to be shown in a more explicit, graphical way then
      you might want to consider doing a custom control that actually
      displays the graph of relationships in a visual way (nodes,
      connections, etc.) Of course, there's not any .NET control I'm aware
      of that supports this, so you'd have to implement it completely
      yourself (or find a pre-made one that you can license). The previous
      two suggestions could be done completely with just the built-in
      functionality.

      I will refrain from asking how you got to a point where you've got this
      complex, circularly-referenced data structure. I've done 3D stuff
      before, and I've never run into a situation where I needed that
      complete a description of the relationships between my data. You might
      want to think about whether a data structure that causes problem when
      trying to represent it visually might not also cause problems later
      down the road when trying to maintain the code.

      I've seen a lot of complicated data structures, but I've found that the
      most useful are often ones that can be easily visualized and are
      relatively simple. That way, my brain doesn't have to work so hard
      when I'm trying to figure out how to fit all the pieces together. :)

      Pete

      Comment

      • colin

        #4
        Re: TreeView or DataGridView ?

        "Peter Duniho" <NpOeStPeAdM@Nn OwSlPiAnMk.comw rote in message
        news:2007113014 092027544-NpOeStPeAdM@NnO wSlPiAnMkcom...
        On 2007-11-30 13:18:51 -0800, "colin" <colin.rowe1@nt world.NOSPAM.co m>
        said:
        >
        >thanks,
        >im looking at those and its quite usefull information.
        >most of those ilustrations look like either trees or grids though.
        >>
        >it is much more than a tree, and the usefull depth of nesting is quite
        >limited,
        >but its also a bit more than a grid,
        >what I realy need is a grid with sub grids,
        >
        I haven't tried it, but it seems like you could use the TableLayoutPane l,
        which has a grid-like paradigm, where you put a whole TableLayoutPane l
        into a cell of another TableLayoutPane l.
        cool, if i was going to do it custom style this may be good basis.
        As you say, you don't want to go too deep, otherwise you don't have room
        to display everything. But that's an issue anyway.
        >
        Now, all that said, I'm wondering if this "nested grid" idea is really the
        best way to display the data anyway. If it's for your own use, I suppose
        you can do whatever UI you like best. But IMHO anything for broader use
        needs to consider what's easy to use, and I'm not sure a nested grid is an
        easily-understood concept, especially if there are circular connections in
        multiple dimensions within the grid (as it sounds as though there are).
        Yeah actually its not quite nested in a true sense, the 'nested' grid would
        idealy
        apear below the row wich is its parent, slightly indented to make it obvious
        its a child.
        as you say you wouldnt be able to fit much of a grid into one cell of
        another grid.
        the circular connections are just simply an easier way to find data,
        as each object needs to know whats its connected to when it is modified.
        the circular nature is probably not an issue especialy if the nesting depth
        is limited to where it cant circle back to itself.
        I think that something more like an "inspector" UI would work better. One
        possibility would be to allow arbitrarily many windows, each representing
        a single object, to be open. Then you'd just double-click on a reference
        within an object to open a new window showing you that referenced object.
        Obviously you'd also have to have some way to show the top-level
        collections. That could be a single window with a TreeView containing
        three root nodes, one root for each type of object, or one window for each
        type of object, or whatever.
        thats probably a lot easier way to implmenet it.
        thats a bit like the data viewer in the visual IDE.

        but it would be cool if the table opened up instead,
        so one window didnt hide ita parent object
        Alternatively, you might just have three windows, one for each collection.
        Within a window you would be able to expand a single object to show its
        contents (so a TreeView or similar). But double-clicking a referenced
        object of another type would select that instance in the window
        corresponding to that type, rather than showing the data in the owning
        object's window.
        I gues I would have three grid views anyway one for each collection.
        as they need diferent colum headings.
        thats an easy way to start with a flat view.


        also I was looking at ways of making a space in the grid
        open up by having a wide blank row wich was othewise invisible,
        and just simply plonking the child grid right on top of it.
        this might be an easy bodge.

        it does however seem this is something thats easily done in asp,
        I just wish it was implmented as easily on c# with windows forms and
        controls.
        As a third alternative, if you feel that the relationships between the
        objects really need to be shown in a more explicit, graphical way then you
        might want to consider doing a custom control that actually displays the
        graph of relationships in a visual way (nodes, connections, etc.) Of
        course, there's not any .NET control I'm aware of that supports this, so
        you'd have to implement it completely yourself (or find a pre-made one
        that you can license). The previous two suggestions could be done
        completely with just the built-in functionality.
        the model is already shown in full 3d, and can be editied by selecting with
        mouse and draging,
        so thats not realy an issue, its just if data needs to be fine tuned to get
        rid of
        stupid rounding errors or something, and also for looking to see whats gone
        horribly wrong
        somewhere not that I hope that ever happens.
        I will refrain from asking how you got to a point where you've got this
        complex, circularly-referenced data structure. I've done 3D stuff before,
        and I've never run into a situation where I needed that complete a
        description of the relationships between my data. You might want to think
        about whether a data structure that causes problem when trying to
        represent it visually might not also cause problems later down the road
        when trying to maintain the code.
        Ive probably over emphasized the complexity im not sure it needs more than 1
        sub level
        but a sub level depth of 1 would no easier to do than 2 or 3.

        I might revisit the circular nature from that point of view,
        it was otherwise a fair bit of efort to find out what each object is
        connected to,
        eg when moving each point of a surface to keep it coplaner
        and also all adjoining surfaces coplaner too you need to know a fair bit
        about
        everything that is connected to it.
        the same for when you try and move a single point or a wire.
        it did however cuase 1 or 2 problems ensuring the connections were tied
        together when inserting deleting
        objects.
        I've seen a lot of complicated data structures, but I've found that the
        most useful are often ones that can be easily visualized and are
        relatively simple. That way, my brain doesn't have to work so hard when
        I'm trying to figure out how to fit all the pieces together. :)
        theres just lots of numbers I want to make it easiest to navigate to the
        right one.
        im trying to make up for a lack of certain features in the available editor.

        many thanks
        Colin =^.^=


        Comment

        • colin

          #5
          Re: TreeView or DataGridView ?

          I think for now i'l use 3 flat grids on my form,
          one will list the surfaces, the next will list wires
          either in the whole model or in the selected surface.
          the same for points.

          maybe each list could select wether it showd all the object
          in the model or just the ones connected to the one iof the selected objects
          in the other list.

          thatl probably do, would stil be nice to have drop down sub grids though ...

          thanks for all the input :)

          Colin =^.^=


          "colin" <colin.rowe1@nt world.NOSPAM.co mwrote in message
          news:fOZ3j.38$H c3.27@newsfe1-gui.ntli.net...
          Hi,
          I wish to display and edit 3 collections of different object types,
          each object type also has a collection of the other 2 types,
          such that if one object contains another then the reverse
          is always true, a many to many relationship.
          >
          the objects are 3d objects making up a wire mesh model,
          points,wire,sur faces.
          >
          im not sure wich is the best way to go,
          it kind of needs a tree structure,
          but it also has a datagrid type of structure too,
          so is it a tree of grids or a grid of trees?
          >
          obviously the whole thing is totally recursive,
          so the depth would be limited to something sensible like 3,
          this kinda makes it more grid like.
          >
          The rest of the application ive done with
          3d wireframe view/editing with XNA,
          but im new to this sort of advanced control,
          ive made my own tree/dir structure before,
          but long long ago when the controls were rather limited,
          (win3.1) lol.
          >
          have things move on much more?
          Im trying to get to grips with the databinding,
          but failing miserable, is it limited to text only data?
          ive looked at a few tutorials and samples,
          but its hard to see if they can be expanded,
          can you have another datagrid inside another ?
          maybe I should just make my own again.
          >
          for each item in the list I need to be able display the list of items in
          it,
          preferably in another grid view below it wich is indented,
          a bit like the visual ide does with data in the debuger but
          wich doesnt stack up on top of each other or disapear when you move the
          mouse away.
          >
          some objects have upto 4 3d vectors wich is 12 numbers
          plus I need to be able to set some flags and highlight things etc.
          >
          Any helpfull ideas tutorials,examp les greatly appreciated :)
          >
          thanks
          Colin =^.^=
          >

          Comment

          Working...