Hi Ruchika, I have a somewhat generic solution that may or may not address your needs; however, it does collapse all of the strataCollapsableContainers except the one you click on:
using System.Windows.Forms;
using MicroFour.StrataFrame.UI.Windows.Forms;
namespace FlowPanelTest
{
public partial class Form1 : StandardForm
{
public Form1()
{ InitializeComponent();
// this could also use a ForEach loop that looks for the container type:
strataCollapsableContainer1.IsBodyShown = false;
strataCollapsableContainer2.IsBodyShown = false;
}
private void CollapseOtherContainers (
StrataCollapsableContainer scc )
{ listBox1.Items.Clear();
foreach (Control ctrl in flowLayoutPanel1.Controls)
{ StrataCollapsableContainer c = ctrl as StrataCollapsableContainer;
if (c != null)
{ if (c == scc)
{c.IsBodyShown = true;
listBox1.Items.Add("Expanding " + c.Name);
}
else
{c.IsBodyShown = false;
listBox1.Items.Add("Collapsing " + c.Name);
}
}
}
}
private void strataCollapsableContainer2_Click(object sender, System.EventArgs e)
{ CollapseOtherContainers(strataCollapsableContainer2); }
private void strataCollapsableContainer1_Click(object sender, System.EventArgs e)
{ CollapseOtherContainers(strataCollapsableContainer1); }
}
}
The zipped project is attached.
Les