I can't find way to scroll in WP7. I have more blocks outside the emulator screen but I can't scroll it. any ideas? I am newbie in visual, just trying to learn, so please explain where should I copy code:)
x:Class="Fitness_excercises.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True" d:DesignHeight="768" d:DesignWidth="480">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent" Height="976" Width="480">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="904*" />
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="Fitness excercises" Style="{StaticResource PhoneTextNormalStyle}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Margin="12,52,12,-3" Grid.RowSpan="2">
<Button Content="Weider's six" Height="72" HorizontalAlignment="Center" Margin="-12,52,46,0" Name="button1" VerticalAlignment="Top" Width="422" />
<Button Content="Waist Slimming Exercises" Height="72" HorizontalAlignment="Left" Margin="-12,104,0,0" Name="button2" VerticalAlignment="Top" Width="422" />
<Button Content="Leg excercises" Height="72" HorizontalAlignment="Left" Margin="-12,157,0,0" Name="button3" VerticalAlignment="Top" Width="422" />
<Button Content="Buttocks excercises" Height="72" HorizontalAlignment="Left" Margin="-12,209,0,0" Name="button4" VerticalAlignment="Top" Width="422" />
<Button Content="Hand and wrist excercises" Height="72" HorizontalAlignment="Left" Margin="-12,262,0,0" Name="button5" VerticalAlignment="Top" Width="422" />
<Button Content="Warm-up" Height="72" HorizontalAlignment="Left" Margin="-12,0,0,0" Name="button6" VerticalAlignment="Top" Width="422" />
<Button Content="100 push-ups" Height="72" HorizontalAlignment="Left" Margin="-13,576,0,0" Name="button7" VerticalAlignment="Top" Width="422" />
<Button Content="300 crunches" Height="72" HorizontalAlignment="Left" Margin="-12,367,0,0" Name="button8" VerticalAlignment="Top" Width="422" />
<Button Content="Aerobic training" Height="72" HorizontalAlignment="Left" Margin="-12,418,0,0" Name="button9" VerticalAlignment="Top" Width="422" />
<Button Content="50 pull-ups" Height="72" HorizontalAlignment="Left" Margin="-12,469,0,0" Name="button10" VerticalAlignment="Top" Width="422" />
<Button Content="300 squats" Height="72" HorizontalAlignment="Left" Margin="-12,524,0,0" Name="button11" VerticalAlignment="Top" Width="422" />
<Button Content="Chest excercises" Height="72" HorizontalAlignment="Left" Margin="-12,313,0,0" Name="button13" VerticalAlignment="Top" Width="422" />
<Button Content="Diet atlas" Height="82" HorizontalAlignment="Left" Margin="-13,629,0,0" Name="button12" VerticalAlignment="Top" Width="422" />
<Button Content="Button" Height="82" HorizontalAlignment="Left" Margin="-13,693,0,0" Name="button14" VerticalAlignment="Top" Width="422" />
<ScrollViewer Height="716" HorizontalAlignment="Left" Margin="456,0,0,0" Name="ScrollViewer1" VerticalAlignment="Top" Width="0" />
</Grid>
</Grid>
<!--Sample code showing usage of ApplicationBar-->
<!--<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>-->
Which part of the interface are you wanting to have scroll? Whichever part that is, you should surround that element with a <ScrollViewer>
.
For example, if you're wanting to have the ContentPanel Grid scroll, you would do something like this:
<ScrollViewer
<Grid x:Name="ContentPanel" Margin="12,52,12,-3" Grid.RowSpan="2">
....
</Grid>
</ScrollViewer>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.