TreeView or DataGridView ?

C

colin

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,surfaces.

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,examples greatly appreciated :)

thanks
Colin =^.^=
 
N

Nicholas Paldino [.NET/C# MVP]

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:

http://blogs.msdn.com/atc_avalon_team/archive/2006/03/01/541206.aspx

Which Chris Sells goes into further detail at:

http://www.sellsbrothers.com/news/showTopic.aspx?ixTopic=2128
 
C

colin

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,
one cell expands to a whole sub grid but it obviously cant fit in
the same cell.
the sub grid idealy is a complete grid with title/headings/border etc,
and would idealy just sit inbetween the two rows maybe best indented a bit.
I doubt the gridview can accomodate things inbetween its rows ?
if it could it would be the answer.
and ofc that grid can also have sub grids in it,
its recursive but thats probably as many levels as would be comprehensible.

the other thing is that there could be 2 or 3 cells in a row wich
could have a subgrid, wich is unlike most tree structures.

Im thinking to go the custom route atm, but im willing to wade through a
certian amount of info
but after a certian time looking it seems easier to just knock someting up
unless I come accros something wich doesnt take too much time to digest.

I would be surprised if someone somewhere hasnt done something just like
this already.

I am wondering how I can tie each cell to the particular data item so I can
update it as it is edited
most items are floats wich are maybe nested 3 deep inside structs/classes.
they need to be able to be editied from the grid or
elsewhere within the same app and kept up to date.
maybe I just need to simply iterate through the entire data set each time
one or the other is changed.

as for wpf, im not sure about .net 3 yet.

Colin =^.^=


Nicholas Paldino said:
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:

http://blogs.msdn.com/atc_avalon_team/archive/2006/03/01/541206.aspx

Which Chris Sells goes into further detail at:

http://www.sellsbrothers.com/news/showTopic.aspx?ixTopic=2128


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

colin said:
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,surfaces.

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,examples greatly appreciated :)

thanks
Colin =^.^=
 
N

Nicholas Paldino [.NET/C# MVP]

Colin,

If you need nested subgrids, then I would really look into a third-party
grid implementation that can handle this for you, as implementing this
yourself could be really, really tedious (to say the least).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

colin 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,
one cell expands to a whole sub grid but it obviously cant fit in
the same cell.
the sub grid idealy is a complete grid with title/headings/border etc,
and would idealy just sit inbetween the two rows maybe best indented a
bit.
I doubt the gridview can accomodate things inbetween its rows ?
if it could it would be the answer.
and ofc that grid can also have sub grids in it,
its recursive but thats probably as many levels as would be
comprehensible.

the other thing is that there could be 2 or 3 cells in a row wich
could have a subgrid, wich is unlike most tree structures.

Im thinking to go the custom route atm, but im willing to wade through a
certian amount of info
but after a certian time looking it seems easier to just knock someting up
unless I come accros something wich doesnt take too much time to digest.

I would be surprised if someone somewhere hasnt done something just like
this already.

I am wondering how I can tie each cell to the particular data item so I
can update it as it is edited
most items are floats wich are maybe nested 3 deep inside structs/classes.
they need to be able to be editied from the grid or
elsewhere within the same app and kept up to date.
maybe I just need to simply iterate through the entire data set each time
one or the other is changed.

as for wpf, im not sure about .net 3 yet.

Colin =^.^=


Nicholas Paldino said:
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:

http://blogs.msdn.com/atc_avalon_team/archive/2006/03/01/541206.aspx

Which Chris Sells goes into further detail at:

http://www.sellsbrothers.com/news/showTopic.aspx?ixTopic=2128


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

colin said:
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,surfaces.

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,examples greatly appreciated :)

thanks
Colin =^.^=
 
P

Peter Duniho

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
TableLayoutPanel, which has a grid-like paradigm, where you put a whole
TableLayoutPanel into a cell of another TableLayoutPanel.

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
 
C

colin

Yeah I think your right about how tedious its going to be,
however Ive come accros quite a lot about nested gridviews but
they all seem to be to do with Asp

I realy cant find anything wich isnt implmeneted as part of a webpage,
this is the closest I have got
http://www.codeproject.com/useritems/SkinSample.asp
its got some c# code but I dont think I can just use that in my c#
application.
I cant seem to find the equivalent control properties in the
windows.forms.gridview
such making the first colum a template field, and dynamic row creation.

Is this why an increasing number of applications seem to
require to work through internet explorer ?

is it possible .net3 will have these extra features?

I cant seem to find any 3rd party c# nested gridsviews but im stil looking.
I dont relish the prospect of doing it custom
or via a webpage, I have implmeneted what I can in a flat
gridview for now wich was a piece of pie - just followed a simple sample.

Colin =^.^=


Nicholas Paldino said:
Colin,

If you need nested subgrids, then I would really look into a
third-party grid implementation that can handle this for you, as
implementing this yourself could be really, really tedious (to say the
least).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

colin 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,
one cell expands to a whole sub grid but it obviously cant fit in
the same cell.
the sub grid idealy is a complete grid with title/headings/border etc,
and would idealy just sit inbetween the two rows maybe best indented a
bit.
I doubt the gridview can accomodate things inbetween its rows ?
if it could it would be the answer.
and ofc that grid can also have sub grids in it,
its recursive but thats probably as many levels as would be
comprehensible.

the other thing is that there could be 2 or 3 cells in a row wich
could have a subgrid, wich is unlike most tree structures.

Im thinking to go the custom route atm, but im willing to wade through a
certian amount of info
but after a certian time looking it seems easier to just knock someting
up
unless I come accros something wich doesnt take too much time to digest.

I would be surprised if someone somewhere hasnt done something just like
this already.

I am wondering how I can tie each cell to the particular data item so I
can update it as it is edited
most items are floats wich are maybe nested 3 deep inside
structs/classes.
they need to be able to be editied from the grid or
elsewhere within the same app and kept up to date.
maybe I just need to simply iterate through the entire data set each time
one or the other is changed.

as for wpf, im not sure about .net 3 yet.

Colin =^.^=


Nicholas Paldino said:
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:

http://blogs.msdn.com/atc_avalon_team/archive/2006/03/01/541206.aspx

Which Chris Sells goes into further detail at:

http://www.sellsbrothers.com/news/showTopic.aspx?ixTopic=2128


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

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,surfaces.

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,examples greatly appreciated :)

thanks
Colin =^.^=
 
C

colin

Peter Duniho said:
I haven't tried it, but it seems like you could use the TableLayoutPanel,
which has a grid-like paradigm, where you put a whole TableLayoutPanel
into a cell of another TableLayoutPanel.

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 =^.^=
 
C

colin

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 =^.^=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top