c# - Silverlight TreeView ScrollBars disappear inside a StackPanel -


I am creating a project that loads data from a webservice into a TreeView control. When TreeView is based on the LayoutRoot grid by itself and its height is set to Auto, if the content tree is located beyond vertical or horizontal borders of the scrollbar, then automatically appears, as expected.

If the same TreeView control is placed inside a StackPanel, this behavior change is when the data extends its boundaries, then no scrollbar is visible and the data does not access clips from the edge only . If I manually set the treeView height in this scenario, the scrollbar will be visible again as expected.

Obviously some interactions occur between the stackpayell and theview, which I am not seeing.

Can someone explain it and suggest appropriate ways to handle the situation?

Comment per request:

The following XAML works fine and presents the expected scrollbar (height is specified on the TreeView notice):

  & Lt; StackPainel & gt; & Lt; Control: Tree View item template = "{static resource meniente index template}" x: name = "codebookindexeview" height = "500" /> & Lt; / StackPanel & gt;  

Displays the following scrollbar as expected (not the notification, but the height of the trewi is set to auto):

  & lt; Control: TreeView item template = "{static resource mainintry index template}" X: name = "codebookindexeview" height = "auto" /> Finally, this code fails in that the TreeView will not control the scrollbar and the data scroll down and / or on the right side (note that the tree view is the height of a stackpayel and trivius Auto is set to:)  
  & lt; StackPainel & gt; & Lt; Control: Tree View item template = "{static resource mainintry index template}" x: name = "codebookindexeview" height = "auto" /> & Lt; / StackPanel & gt;  

Cheers,

Steve

This one was detected with some help from the Silverlight.net forum. You can read the original questions and answers. It has been learned that a stackpellel oriented (defaul orientation) will infinite children, due to the infinite size of the TreeView, the scroll bar will never be displayed. It does not happen when the grid is used as your layout element.

The following XAML will present the TreeView scroll bar as expected (note that the tree view is contained in the row 2 of a grid, not a stackpanel, and the height of the tree weigh is set to Auto.) This code There are some additional controls in the snippet because the reason for the extra container was in the first place:

  & lt; Grid & gt; & Lt; Grid.RowDefinitions & gt; & Lt; RowDefinition Height = "Auto" /> & Lt; RowDefinition Height = "Auto" /> & Lt; Roadfinion height = "*" /> & Lt; /Grid.RowDefinitions> & Lt; StackPanel Orientation = "Horizontal" Grid. Rau = "0" & ​​gt; & Lt; Textbox text = "enter search terms" / & gt; & Lt; Text box x: name = "searchTermTextbox" width = "200" keypath = "SearchTermTextBox -Keyp" /> & Lt; / StackPanel & gt; & Lt; Button x: name = "search button" content = "search" = "SearchButton_Click" width = "100" horizontal tracing = "left" grid. Line = "1" /> & Lt; Control: Tree View item template = "{static resource mainintry index template}" X: name = "codebookindexreview" height = "auto" grid. Raw = "2" /> & Lt; / Grid & gt;  

Comments