Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Control Nested Grid indentation

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Control Nested Grid indentation
Link Posted: 14-Nov-2005 12:55
How do I control the indentation for nested grids?
Link Posted: 14-Nov-2005 16:21
You can change Indent property of HierachyColumn/TreeViewcolumn in the FlyGrid to change indentation of nested columns:


(nestedGrid.Columns.Items[0] as HierachyColumn).Indent = 30;
Link Posted: 15-Nov-2005 11:24
My grids have tree nodes as well, so the indent prop on the column seems to affect both.    
I could create seperate columns so I can set two ident props    , but then I'd have to wire the node click event to exand the grid control node.  Does this seem feasable, or is there a better way?
Link Posted: 16-Nov-2005 10:21
You can use NestedHierachyColumn to have dynamically changed indentation. Insert this column as first to your root columns and nested to get Access-like view of FlyGrid.
Link Posted: 16-Nov-2005 11:02
I don't see a NestedHeirarchyColumn class anywhere ???

Can you just give a quick code snippet of your approach?
If it helps, here some code that illustrates the problem:


flyGrid1.BeginInit();

HierachyColumn hierarchy = new HierachyColumn("Hierarchy");
hierarchy.ShowCheckBoxes = true;
hierarchy.FitMode = ColumnFitMode.SmartFit;
flyGrid1.Columns.Items.Add(hierarchy);
flyGrid1.Columns.NestedColumns.Items.Add(new Column("Hierarchy"));
flyGrid1.Columns.NestedColumns.Items.Add(new BooleanColumn("Check"));

TreeViewNode parentNode = new TreeViewNode(new object[] {"Hello"});
flyGrid1.Rows.RootNode.Items.Add(parentNode);

TreeViewNode childNode = new TreeViewNode(new object[] {"World"});
parentNode.Items.Add(childNode);

NestedGridNode gridNode = new NestedGridNode();
gridNode.Value = "Opens Inner Grid";
childNode.Items.Add(gridNode);

TreeViewNode parentInnerGridNode = new TreeViewNode(new object[] {"Hello", true});
gridNode.Items.Add(parentInnerGridNode);

TreeViewNode childInnerGridNode = new TreeViewNode(new object[] {"World", false});
gridNode.Items.Add(childInnerGridNode);

flyGrid1.Rows.RootNode.ExpandAll();
flyGrid1.EndInit();


The grid is indented only as a second level node relative to the top node, not the node it is under.
Link Posted: 16-Nov-2005 11:19
Ok, I came up with the following, which seems a little hokey, but it works:


flyGrid1.BeginInit();

HierachyColumn hierarchy = new HierachyColumn("Hierarchy2");
hierarchy.Visible = false;
hierarchy.Indent = 75;
flyGrid1.Columns.Items.Add(hierarchy);

hierarchy = new TreeViewColumn("Hierarchy1");
hierarchy.ShowCheckBoxes = true;
hierarchy.FitMode = ColumnFitMode.SmartFit;
flyGrid1.Columns.Items.Add(hierarchy);



flyGrid1.Columns.NestedColumns.Items.Add(new Column("Hierarchy"));
flyGrid1.Columns.NestedColumns.Items.Add(new BooleanColumn("Check"));

TreeViewNode parentNode = new TreeViewNode(new object[] {"Hello", "Hello"});
flyGrid1.Rows.RootNode.Items.Add(parentNode);

TreeViewNode childNode = new TreeViewNode(new object[] {"World", "World"});
parentNode.Items.Add(childNode);

NestedGridNode gridNode = new NestedGridNode();
gridNode.Value = new object[] {"Opens Inner Grid", "Opens Inner Grid"};
childNode.Items.Add(gridNode);

TreeViewNode parentInnerGridNode = new TreeViewNode(new object[] {"Hello", true});
gridNode.Items.Add(parentInnerGridNode);

TreeViewNode childInnerGridNode = new TreeViewNode(new object[] {"World", false});
gridNode.Items.Add(childInnerGridNode);

flyGrid1.Rows.RootNode.ExpandAll();
flyGrid1.EndInit();
Link Posted: 19-Nov-2005 05:50
NineRays.Windows.Forms.Grids.NestedHierachyColumn
you can find this class in the NineRays.FlyGrid.Columns.DLL (available in the Pro version and in the Evaluation version)
Link Posted: 21-Nov-2005 10:29
I downloaded eval, version of NineRays.FlyGrid.Columns is 1.2.6.2652.  Can't find this class.  HeirarchyColumn and NestedGridNode are in ninerays.flygrid.
Link Posted: 22-Nov-2005 07:40
Find this column type in the NineRays.FlyGrid.Columns.dll that comes with FlyGrid Evaluation versioon.