![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |