To stack or not to stack?

What’s the best way to go in this situation:

I have a title bar, and a content section. (title bar is the one from GHI)
However, I would like to have some sort of settings page with buttons and text. (buttons are in fact Bitmaps in the style of a button)

So. What I want is this:

Text: ButtonOn ButtonOff
Text2: ButtonOn2 ButtonOff2

Etc.

If I set the content in a stackpanel with orientation horizontal, it’s displayed as mentioned above. If I include the title, it gets messed up. (content not visible)

However, what’s the best way to do this? Using 2 stack panels does not seem to work either?
Is there a trick?

Thanks! :wink:

Vertical stackpanel with the horizontal titlebar stack panel in the top?

I thought of this too. But I would need to add:

this.Child = stack;
this.Child = stack2;

And this way only stack2 gets added to the window?

If I add both of them to the same stack panel with vertical alignment, it looks like this:

Text:
ButtonOn
ButtonOff

Child is only to be set to one UIElemnt. You need to set Child to the big stackpanel (vert) then add the titlebar stack to the vert stack.

So, Chris helped me in the chat.

This is the way to go:


stack_Content = new StackPanel(Orientation.Horizontal);
stack_Title = new StackPanel(Orientation.Horizontal);
stack_Window = new StackPanel(Orientation.Vertical);

Create 3 stack panels. stack_Window is the child of the UIElement. Inside stack_Window, the two other stacks should be loaded to make this work.


stack_Window.Children.Add(stack_Title);
stack_Window.Children.Add(stack_Content);

Edit: Oh yeah, don’t forget to assign the child:

this.Child = stack_Window;