Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Dynamic row height examples?

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

Dynamic row height examples?
Link Posted: 18-Apr-2006 03:35
Hi,

Can you point me to any samples that demonstrate dynamic row heights? I see the user can change individual row heights when I set RowSizing=free. However, I’d like to programmatically do this so that I have two flygrids next to each other. The first just has a treeview column. It will have dynamic row sizes since the second grid will be just be to the right of it with 1-n rows for each node in the tree view.


[--------------------][---------]
[    Node            ][ subrow1 ]
[--------------------][---------]
[      ChildNode1    ][ subrow1 ]
[                    ][ subrow2 ]
[                    ][ subrow3 ]
[--------------------][---------]
[      ChildNode2    ][ subrow1 ]
[--------------------][---------]


Thank you,
Mark
Link Posted: 18-Apr-2006 05:24
You can change the row height by using Rows.SetNodeHeight method.
But to implement the layout mentioned in your question will be better to use NestedGrids - see the NestedGrids, Virtual Nested Grid sample.
Or you can use SeparatorNode nodes to separate subrows. See the Group ing samples.
[c#]
private AddGroup(NodeCollection nodes, string groupName, object[][] data)
{
  NodeBase groupNode = new SeparatorNode(groupName);
  Node[] subnodes = new Node[data.Length];
  for(int i=0; i < subnodes.Length; i++)
  {
    subnodes[i] = new Node(data[i]);
  }
  groupNode.Items.AddRange(subnodes);
  nodes.Add(groupNode);
}
Link Posted: 18-Apr-2006 06:17
I have a simple test where I've added a single treeview column and have used SetNodeHeight after adding the nodes to the grid. However, as soon as the tree is expanded, all heights are lost. Is that expected behavior? I found a workaround would be to re-set *all* nodes heights in the NodeExpand event, but that seems expensive.

Note: It would be nice to be able to specify the height when the node is created, rather than having to go through the  grid.rows method since it seems that would be easier to implement for virtual grids where nodes are created on the fly.

I played with the group example, but I didn't really see where that fit my requirements. The nested grids I think wouldn't work either. But, I will continue to ruminate on those.

Thank you for the quick reply.

Best,
Mark
Link Posted: 19-Apr-2006 07:17
Yes, we've found a bug, that has been fixed.
We are planning to publish update today/tomorrow.