charles082986
charles082986

Reputation: 181

Adding a Scroll Bar to a Frame WPF

One of the pages I load into my frame is considerably larger than the frame itself. I have tried the instructions found at Frame on a resizable Window should show Scrollbar and my resulting xaml looks like this:

<ScrollViewer>
<Frame 
    ScrollViewer.VerticalScrollBarVisibility="Visible" 
    ScrollViewer.CanContentScroll="True" 
    Content="" 
    Name="mainFrame" 
    Grid.Row="1" 
    NavigationUIVisibility="Hidden" 
    Source="LoginPage.xaml"/>
</ScrollViewer>

Unfortunately, when I run this WPF application, the pages and/or frame are completely hidden. Removing the 2 ScrollViewer tags at the top and bottom of the code allow me to navigate again, but the problem page still has no scroll bars.

Upvotes: 3

Views: 7457

Answers (1)

Kevin DiTraglia
Kevin DiTraglia

Reputation: 26068

My first guess would be you are losing the grid row you want to be in via the nesting. Try this:

<ScrollViewer Grid.Row="1" >
<Frame 
    ScrollViewer.VerticalScrollBarVisibility="Visible" 
    ScrollViewer.CanContentScroll="True" 
    Content="" 
    Name="mainFrame" 
    NavigationUIVisibility="Hidden" 
    Source="LoginPage.xaml"/>
</ScrollViewer>

Upvotes: 3

Related Questions