Reputation: 87
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.
Upvotes: 6
Views: 3402
Reputation: 8626
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>
Upvotes: 7
Reputation: 9857
In short though you're not going to scroll a grid. You are going to create a grid set to the screen size or smaller. Then put a listbox inside it. You can scroll the listbox easily because that's what it does.
<Grid margin="0,0,0,0" width="480" hieght="800"> <!--These values probably need ajusted-->
<ListBox height="800"> <!--Make sure that it is ENTIRLEY on the screen -->
<TextBlock>Put a ton of text here and see that it scrolls</TextBlock>
<Button>You can put anything in the list boxes</Button>
<TextBox>Even Inputs</TextBox>
</ListBox>
</Grid>
Another viable option that is mentioned below is a scroll viewer which works just as well.
Upvotes: 1