Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to scroll a Grid?

I have a Grid which its Height can grow like this:

<Grid.RowDefinitions>
    <RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
    <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>


<Grid Name="Grid" Grid.Row="0" Grid.Column="0">

</Grid>

How can I scroll it up-down?

it is a windows phone 8 app.

like image 402
ching Avatar asked Jul 30 '13 12:07

ching


People also ask

How do I scroll vertically?

For vertical scrollable bar use the x and y axis. Set the overflow-x:hidden; and overflow-y:auto; that will automatically hide the horizontal scroll bar and present only vertical scrollbar. Here the scroll div will be vertically scrollable.

How do I create a horizontal scrolling container?

For horizontal scrollable bar use the x and y-axis. Set the overflow-y: hidden; and overflow-x: auto; that will automatically hide the vertical scroll bar and present only the horizontal scrollbar. The white-space: nowrap; property is used to wrap text in a single line.


1 Answers

You can structure your grid as:

 <Grid x:Name="LayoutRoot" Background="Transparent">
       <Grid.RowDefinitions>
    <RowDefinition Height="120" />
    <RowDefinition Height="*" />
    <RowDefinition Height="3*" />
    <RowDefinition Height="5*" />
</Grid.RowDefinitions>
        <Grid> 
           ***content goes here****
        </Grid>
        <ScrollViewer VerticalScrollBarVisibility="Visible" Grid.Row="1">
            *****Put scalable content here*******
        </ScrollViewer>
        <Grid Grid.Row="0"> 
           ***content goes here****
        </Grid>
    </Grid>
like image 59
C Sharper Avatar answered Sep 22 '22 17:09

C Sharper