StrataCollapsable Container Link Manager


Author
Message
Ruchika Garg
Ruchika Garg
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: StrataFrame Users
Posts: 17, Visits: 70
Where can i get more information on how to use StrataCollapsable Container Link Manager?
Ruchika Garg
Ruchika Garg
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: StrataFrame Users
Posts: 17, Visits: 70
I want to put two strataframe collapsable control on one window and want the functionality where when user collapse one container the other container should expand and resize itself to fill the entire window.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
This is pretty easy. First, you'll want to drop the SF collapsible containers into a FlowLayoutPanel. This will handle the resizing. Next, you need to add containers to the link manager manually in the constructor of the form. I'm hoping they make this declarative soon, but form now you just need to do it in code. Finally, you may want to set which panels are initially collapsed, also in constructor.



Hope that gets you started! BigGrin
Ruchika Garg
Ruchika Garg
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: StrataFrame Users
Posts: 17, Visits: 70
Yeah that will work..thanks a lot ..
Ruchika Garg
Ruchika Garg
StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)StrataFrame Beginner (23 reputation)
Group: StrataFrame Users
Posts: 17, Visits: 70
it didn't work.. :-(
Leonard P.
Leonard P.
StrataFrame Novice (79 reputation)StrataFrame Novice (79 reputation)StrataFrame Novice (79 reputation)StrataFrame Novice (79 reputation)StrataFrame Novice (79 reputation)StrataFrame Novice (79 reputation)StrataFrame Novice (79 reputation)StrataFrame Novice (79 reputation)StrataFrame Novice (79 reputation)
Group: Awaiting Activation
Posts: 65, Visits: 306
Hi,

It could be achieved by tweaking Containers Dock property each time one container expends.

You need to set Dock property of a container being expended to Fill, and other containers to Top or Bottom depending on their position relative to the expending control.



For example, If you have 3 Collapsible Containers (at the Top, Middle, and Bottom) your code would look something like this:



private void Form1_Load(object sender, EventArgs e)

{



strataCollapsableContainerTop.IsBodyShown = true;









strataCollapsableContainerBottom.IsBodyShown = false;

strataCollapsableContainerMiddle.IsBodyShown = false;



strataCollapsableContainerLinkManager1.AddContainer(strataCollapsableContainerBottom);

strataCollapsableContainerLinkManager1.AddContainer(strataCollapsableContainerTop);

strataCollapsableContainerLinkManager1.AddContainer(strataCollapsableContainerMiddle);





}







private void strataCollapsableContainerMiddle_Opened(object sender, EventArgs e)

{

strataCollapsableContainerMiddle.Dock = DockStyle.Fill;



strataCollapsableContainerBottom.Dock = DockStyle.Bottom;

strataCollapsableContainerTop.Dock = DockStyle.Top;



}



private void strataCollapsableContainerTop_Opened(object sender, EventArgs e)

{

strataCollapsableContainerTop.Dock = DockStyle.Fill;



strataCollapsableContainerBottom.Dock = DockStyle.Bottom;

strataCollapsableContainerMiddle.Dock = DockStyle.Bottom;





}



private void strataCollapsableContainerBottom_Opened(object sender, EventArgs e)

{

strataCollapsableContainerBottom.Dock = DockStyle.Fill;



strataCollapsableContainerMiddle.Dock = DockStyle.Top;

strataCollapsableContainerTop.Dock = DockStyle.Top;

}

Les Pinter
Les Pinter
StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)
Group: Forum Members
Posts: 43, Visits: 213
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

Attachments
FlowPanelTest.zip (119 views, 24.00 KB)
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'm not sure this is more or less efficient or easier to code than Les' example, but the attached project uses the StrataFrameCollapsableContainerLinkManager, which contains the logic to automatically collapse all other containers.



There are a couple of things to note:



- The HeaderHeight isn't the height the header...or at least not the part that is shown when it is collapsed. It is the height of the header plus the action area. I.e. if you set the ActionAreaHeight to 0, then HeaderHeight is the height of the bit shown when collapsed.



- You can't use Dock = Fill. No idea why, but flow layout containers (as I recall) don't like it. Anchoring isn't so hot either. Thus, you have to manage heights if you are going to handle resizing. The project includes an example of how to manage height changes. Width changes are left for your own experimentation Tongue



- Setting the Height of a collapsed container is bad if the container is actually collapsed (IsBodyShown = false). It immediately sets the height of the container (and renders it), but leaves the IsBodyShown property alone. Thus, you now have a collapsed container that is not collapsed. Worse, since the IsBodyShown property is already false, you can't re-collapse is using that property.



- Set things up in the constructor. The controls are all created but aren't actually windows controls yet (no handles, etc.), so you can set heights and IsBodyShown here and it will work. If you wait for the form Load, things get wanky.



- In order to manage resizing, you'll need to handle each containers Opened event, then set the correct height based on the current flowlayoutpanel height. The project includes an example of this. The Opening event doesn't work, due to weirdness between the Height property and the IsBodyShown property...or something like that.



- If you don't need to handle resizing, its really easy to set this up. Example included there also.



- By default, the link manager allows all the containers to be collapsed. Not entirely sure how to stop the last one from collapsing. I'd guess that how easy is it do do that depends on how link manager does the collapsing.



- The collapsible container and the link manager are not on the toolbar by default (there still beta), so if you want to drag and drop them on a form, you'll need to add them to the toolbar manually.



Attached project includes a single form with examples showing resizing (resize the form, flowlayoutpanel anchored to top and bottom) and one without resizing.



Hope this helps! BigGrin







Attachments
AccordianExample.zip (121 views, 21.00 KB)
Les Pinter
Les Pinter
StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)
Group: Forum Members
Posts: 43, Visits: 213
Hi Greg,

   You're right, it does handle things automatically. I just thought some other customization might be the ulterior motive. Also, I'm kind of obsessive about doing things with the fewest possible lines of code - it's a personal shortcoming...<g>

Les

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I was already goofing around with this, attempting to figure out the new stuff in the extended UI assembly, so thought I'd share it. My hope is that the SF folks will take a gander at this thread and improve the link manager. BigGrin
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search