Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Multiple StackPanel

 
 
Old 05-22-2006   #1 (permalink)
kevin725@gmail.com


 
 

Multiple StackPanel

Hello,

I am trying to embed a StackPanel within another StackPanel. The
problem when I click on the first entry of the childPanel, it collapses
the rootPanel (so that childPanel is no longer selected).
So if I selected Child Entry, the StackPanel expands and I see Entry1
Selected. Then I select Entry3, no problem so far. When click back to
Entry1 .. rootPanel becomes collapsed. Are there restrictions about
embedding StackPanels?

Here is a code segment to illustrate what I am doing

childPanel = new StackPanel();
childPanel.add(new Label("This is a child entry1"), "Entry1");
childPanel.add(new Label("This is a child entry2"), "Entry2");
childPanel.add(new Label("This is a child entry3"), "Entry3");

rootPanel = new StackPanel();
rootPanel.add(new Label("Test Entry"), "RootEntry");
rootPanel.add(childPanel, "Child Entry");


Thanks in advance


My System SpecsSystem Spec
Old 05-30-2006   #2 (permalink)
Shalini Aggarwal [MSFT]


 
 

RE: Multiple StackPanel

From your code segment it does not look like you are using WPF (Avalon). In
Avalon,
a) a StackPanel does not have an “add” method
b) you can only add one child at a time to a StackPanel

So, your code snippet should look more like:
StackPanel childPanel = new StackPanel();
Label entry1 = new Label();
entry1.Content = “This is child entry1”;
Label entry2 = new Label();
entry2.Content = “This is child entry2”;
childPanel.Children.Add(entry1);
childPanel.Children.Add(entry2);
...

Also, what is it that you are trying to achieve by placing a StackPanel
inside a StackPanel? How are you programming the collapsing and expanding
behavior you talk about?

-Shalini

----------
"kevin725@gmail.com" wrote:

> Hello,
>
> I am trying to embed a StackPanel within another StackPanel. The
> problem when I click on the first entry of the childPanel, it collapses
> the rootPanel (so that childPanel is no longer selected).
> So if I selected Child Entry, the StackPanel expands and I see Entry1
> Selected. Then I select Entry3, no problem so far. When click back to
> Entry1 .. rootPanel becomes collapsed. Are there restrictions about
> embedding StackPanels?
>
> Here is a code segment to illustrate what I am doing
>
> childPanel = new StackPanel();
> childPanel.add(new Label("This is a child entry1"), "Entry1");
> childPanel.add(new Label("This is a child entry2"), "Entry2");
> childPanel.add(new Label("This is a child entry3"), "Entry3");
>
> rootPanel = new StackPanel();
> rootPanel.add(new Label("Test Entry"), "RootEntry");
> rootPanel.add(childPanel, "Child Entry");
>
>
> Thanks in advance
>
>

My System SpecsSystem Spec
 

Thread Tools



Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46