I have 2 trees in a stackpanel in a grid column, I want that stackpanel to show a vertical scroll bar so as the 2 trees are expanded I can scoll down. Currently it cuts off at the bottom. I have tried using the Scrollviewer attribute on the grid, stackpanel to no avail. Is there a way to do this easily?
Here is the pseudo code...
<Grid x:Name="LayoutRoot" Background="#19246286">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="300" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="580" />
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical" Grid.Row="1" Height="Auto" VerticalAlignment="Top" >
<ig:XamTree x:Name="xamTree1" x:FieldModifier="public" Background="#FFAED0E6">
<ig:XamTreeItem....
</ig:XamTree>
<ig:XamTree x:Name="xamTree2" x:FieldModifier="public" Background="#FFAED0E6">
<ig:XamTreeItem .......
</StackPanel>
Hello,
This should be possible by setting an explicit Height for your StackPanel (though I think this might be taken care of by setting the height on the Grid row). Also, set the StackPanel's ScrollViewer.VerticalScrollBarVisibility property to "Auto".
No luck with this, tree grows, no scrollbar is appearing. Do you have a simple sample demonstrating this?
Okay, I did a bit more research and it looks like this is an issue with how the Microsoft implemented the StackPanel. To get the scrollbars to appear, instead wrap the StackPanel with a ScrollViewer control.
I've attached a sample that demonstrates this.