Dr. Hoads
Dr. Hoads

Reputation: 79

Ungroup panels?

So I am working on a program that has several screens which causes it to have overlapping controls (Buttons and lists).

I put the controls in panels which works great and then do show/hide for the panels.

This also works well.

I am having a problem now that I am up to several panels where when I move one panel up it gets absorbed by another and I need them to stay separate.

Example: When I move panel2 into place over panel1, panel2 becomes part of panel1. Then when I do panel1.Hide() and panel2.Show(), panel2 is still hidden because it is part of panel1. is there a way for me to ungroup these or move panel2 into place without it automatically becoming part of panel1? (I know I can show hide the controls inside of the panels, but this will add a lot of complexity because I have a ton of controls)

Perhaps there is a better solution than using panels?

Upvotes: 0

Views: 626

Answers (1)

Hans Passant
Hans Passant

Reputation: 942099

You can use the View + Other Windows + Document Outline tool window to get these panels separated again. Drag the inner panel back to the parent. You'll then also have to edit the Location property to get it back in the right position.

This is annoying of course and good odds that you'll have to do this repeatedly. There's a better way to go about it, a TabControl has good design-time support and also has the same "overlapping panel" metaphor. You just need to hide the tabs at runtime. That's pretty easy to do, check the StackPanel control in this answer.

Upvotes: 3

Related Questions