Reputation: 514
i am making windows phone app in which it has more than 10 buttons in stack panel but it shows buttons only in space available in screen,so how to achieve scroll in that page so that all buttons can accessible . here is my code:
<phone:PivotItem Header="second">
<StackPanel HorizontalAlignment="Left" Height="595" Margin="10,10,0,0" VerticalAlignment="Top" Width="436">
<Button Content="Button" />
<Button Content="Button" >
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
</StackPanel>
<!--Double line list no text wrapping-->
</phone:PivotItem>
Upvotes: 0
Views: 371
Reputation: 433
Try ScrollViewer class
<ScrollViewer>
<StackPanel HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="436">
<Button Content="Button" />
<Button Content="Button" />
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
</StackPanel>
</ScrollViewer>
Upvotes: 1
Reputation: 2778
This may enable scroll in your layout. try this-
<phone:PivotItem Header="second">
<ScrollViewer Height="500">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
<Button Content="Button" />
<Button Content="Button" >
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
<Button Content="Button"/>
</StackPanel>
</ScrollViewer>
</phone:PivotItem>
Upvotes: 1
Reputation: 514
Yes, a ScrollViewer control can be used to scroll content that is longer than the visible area available to the control ...
<ScrollViewer>
... content goes here ...
</ScrollViewer>
Upvotes: 0