Home - Forums-.NET - FlyGrid.Net (Windows Forms) - TreeView Replacement Sample Error

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

TreeView Replacement Sample Error
Link Posted: 30-Jul-2006 18:08
I notice in the TreeView Replacement Sample App that  Hiding Nodes does not work properly when multiple selection is enabled. Just try it and I'm sure you'll immediately see what I mean.
Link Posted: 30-Jul-2006 22:27
In this sample used code that hides only selected node, nearest update will contain multiple selection nodes hiding.
Now you can use following code to hide multiple selection:
[c#]
private void hideSelectedBtn_Click(object sender, System.EventArgs e)
{
  if ((treeviewGrid.Options & GridOptions.MultiSelect) != 0)
  {
    NodeBase[] selection = treeviewGrid.Rows.GetSelection();
    if (selection != null && selection.Length > 0)
    {
      treeviewGrid.BeginInit();
      try
      {
        foreach(NodeBase node in selection)
        {
          node.Hidden = true;
        }
      }
      finally
      {
        treeviewGrid.EndInit();
      }          
    }
    else MessageBox.Show(\"Nothing selected!\");
  }
  else
  {
    if (treeviewGrid.Selected != null)
    {
      treeviewGrid.Selected.Hidden = true;
    }
    else MessageBox.Show(\"Nothing selected!\");
  }
}