Page 1 of 1

[SOLVED] ScrollViewer doesn't work

Posted: Thu Oct 26, 2017 5:57 am
by Matti111
Hello,
I tried to insert a Grid in a ScrollViewer on MainPage (without canvans). The problem is that when I open project in browser, I didn't see any scrollbar and I cant scroll contents. Do you have Idea to solve the issue?

Thanks
Mattia

Re: ScrollViewer doesn't work

Posted: Thu Oct 26, 2017 6:03 am
by JS-Support @Userware
Hi,

Can you please post the XAML source code?

Thanks.
Regards,
JS-Support

Re: ScrollViewer doesn't work

Posted: Thu Oct 26, 2017 10:47 pm
by Matti111
The page doesn't scroll down to see all contents


<Grid Background="White">
<StackPanel Orientation="Vertical">
<Grid Grid.Row="0" Height="56">
<Grid.Background>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
<GradientStop Color="#9F86FE" Offset="0"/>
<GradientStop Color="#5784FE" Offset="1"/>
</LinearGradientBrush>
</Grid.Background>

<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Height="36">
...
</StackPanel>
</Grid>

<Grid Grid.Row="1">
<Rectangle Fill="White" Height="180"/>
</Grid>
<Grid Grid.Row="2" Height="1000">
...
</Grid>
<Grid Grid.Row="3" >
..
</Grid>

</StackPanel>
</Grid>

Re: ScrollViewer doesn't work

Posted: Fri Oct 27, 2017 1:57 am
by TaterJuice
You are not using the ScrollViewer, your content will not scroll.


Just Add ScrollViewer:


Code: Select all

<Grid Background="White">
   <ScrollViewer>
      <StackPanel Orientation="Vertical">
         <Grid Grid.Row="0" Height="56">
            <Grid.Background>
               <LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
                  <GradientStop Color="#9F86FE" Offset="0"/>
                  <GradientStop Color="#5784FE" Offset="1"/>
               </LinearGradientBrush>
            </Grid.Background>

            <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Height="36">
               <Border
                  VerticalAlignment="Stretch"
                  HorizontalAlignment="Center"
                  Width="55"
                  Background="Green" />
            </StackPanel>
         </Grid>

         <Grid Grid.Row="1">
            <Rectangle Fill="White" Height="180"/>
         </Grid>
         <Grid Grid.Row="2" Height="1000">
            <Border
               VerticalAlignment="Stretch"
               HorizontalAlignment="Center"
               Width="55"
               Background="Green" />
         </Grid>
         <Grid Grid.Row="3" >
            <Border
               Width="300"
               Height="300"
               Background="Red" />
         </Grid>

      </StackPanel>
   </ScrollViewer>
</Grid>



In WPF and SilverLight Scrollviewers can be implemented using attached Properties for ItemsControls, ListViews, ie:

<ListView ScrollViewer.VerticalScrollBarVisibility="Auto" ... />

But they are still separate controls. You need to use the actual ScrollViewer control.

Re: ScrollViewer doesn't work

Posted: Wed Nov 01, 2017 8:42 am
by Matti111
thanks, it works!