Hi all,
I have a question regarding the WinSplitter control.
If I understood the docs right the splitter collapses the panel that has the same docking as the splitter.
So a main-panel hosts the first panel docked bottom, then the splitter docked bottom and last another panel docked Fill.
In this case the panel that is docked bottom gets collapsed.
So far so good, but I am unable to change this to make the top panel gets collapsed.Even if I undock all panels and then redock them in the right order it does not work.
The only solution I figured out was to remove the hostin panels (top, bottom) and the splitter and then start over again docking the top panel first, then the splitter (dock top) and last the panel that gets docked Fill.
Even if I undock them all, remove the splitter, move the panels out of the main panel and try over again I can not archive what I wanted, invert the collapsed panel...
Is there a solution for this problem I am missing?
any help is kindly appreciated.
best regards
Andy
Hi Boris,Honestly I am searching for a way to do this in the designer, not in code.In my opinion it might occure that the decision is made to switch collapsing panels after their initial configuration.
Imagine your superior is telling you to switch the panels, the common way is to modify the UI in the designer and not to write code in order to do so.That way it is also more clear to any other developer working on the project.
What do you think?
Also there is a description for adding panels and splitter in the Infragistics documentation using the designer, but no description how to change the collpasing panel once they have been initially configured.
Can you confirm the "odd" behavior I explained in my last post?
From my point of view its quite strange that you have to recreate panels and splitter instead of just changing the docking (in the designer), which doesn't work as expected and what causes the "odd" behavior I mentioned.
Thanks again Boris, your help is very much appreciated.cheersAndy
Hello Andy,
You could try using the following code(ultraPanel1 is docked fill in Form1 and everything else is in it):
if (ultraSplitter1.Dock == DockStyle.Bottom) { this.ultraPanel1.ClientArea.Controls.Clear(); this.ultraPanel1.ClientArea.Controls.Add(this.ultraPanel3); this.ultraPanel1.ClientArea.Controls.Add(this.ultraSplitter1); this.ultraPanel1.ClientArea.Controls.Add(this.ultraPanel2); ultraPanel2.Dock = DockStyle.Top; ultraPanel3.Dock = DockStyle.Fill; ultraSplitter1.Dock = DockStyle.Top; } else { this.ultraPanel1.ClientArea.Controls.Clear(); this.ultraPanel1.ClientArea.Controls.Add(this.ultraPanel2); this.ultraPanel1.ClientArea.Controls.Add(this.ultraSplitter1); this.ultraPanel1.ClientArea.Controls.Add(this.ultraPanel3); ultraPanel3.Dock = DockStyle.Bottom; ultraSplitter1.Dock = DockStyle.Bottom; ultraPanel2.Dock = DockStyle.Fill; }
Please do not hesitate to contact us if you need any additional assistance.
Hi Boris,I really appreciate the efforts you are taking to help me out here.Nevertheless I don't think that a sample will be necessary. I am looking for a way to change the collapsing panels if they are already positioned using the designer of Visual Studio.
I checked your sample and I am pretty sure that you have changed the collapsing panel here.It show one of the odd behaviors when doing that.
Please be so kind and do the following with the sample you have provided.
- open the form in Visual Studio Designer- mark the red (lower) panel by clicking it- now you see the borders of the panel, which are correct. It only fills the area below the splitter, that is fine.
Now comes the odd part:
- mark the upper (yellow) panel by clicking it.- now you can see that the borders of the upper panle take up the complete form. Which is wrong and will cause overlappings with a more complex UI than with one that only contains a button.
This happens if you manually change the docking after it has ben done initially (the first time)The lower border of the yellow panel should only go down to the splitter and should not take up the complete form.
This is what I was talking about, that happens when you undock and redock panels/splitter in order to change the collapsing panel.As mentioned, this happens always and the only way to work around is recreating all the panels and the splitter.
I hope I was able to clarify my concerns, please be so kind and let me know if you need further information.cheers and thank you for your supportAndy
Please check the sample in this post and let me know if we are on the same page about the wanted behavior.
Hi Boris,honestly I prefer having the panels and the splitter due to certain setup issues.It works pretty fine if you do it correctly in the first place. But in real life sometimes the superiors want it exactly the other way than it was implemented (they do not want a GroupBox neither).
But the efforts that are necessary to change the collapsing panel is often quite huge, especially if its a later stage of a project.
I thought that undocking both panels and the splitter and then redocking them correctly would do the job, but its impossible to make them work correctly after they have been docked the first time.Try it yourself, the panel that is docked to "Fill" always takes up the complete space if you try to redock them.The only solution I found was to undock them, create new panels, copy the content of the old panels to the new ones, remove the old panels/splitter, add a new splitter and then dock the new panels in the right order. Give it a try and you'll see.
This approach is extremely painfull, especially if the panels already contain complex UI elements.
If the redocking would work I would be happy ;)
Please be so kind and check this out and let me know what you think.
cheersAndy