Comment faire ScrollViewer fonctionner correctement dans Windows Phone

J'ai ajouté un ScrollViewer objet sur mon application et j'ai ajouté de nombreux objets de contrôle sur le ScrollViewer objet, mais l'utilisateur final à l'aide de l'application ne peut pas voir tous les éléments, car le parchemin ne défile pas assez bas, et la page de garde de revenir à leur position d'origine avant que l'utilisateur a la possibilité de saisir des informations.

Voici mon XAMLCode :

<phone:PhoneApplicationPage 
x:Class="WinHomeWork2.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" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True" Loaded="PhoneApplicationPage_Loaded">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</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="VOLKOV LTD" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Agent_App" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<ScrollViewer
Name="mainScrollViewer"
Margin="0,175,0,0"
VerticalScrollBarVisibility="Visible" AllowDrop="False" ManipulationMode="Control">
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="300*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100*"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="200*"/>
</Grid.ColumnDefinitions>
<TextBox 
Name="AgentName" 
Height="80" 
Grid.Row="0" 
Grid.Column="3"
/>
<TextBlock 
Name="AgentNameTextBlock"
FontSize="25"
Text="Agent Name" 
Grid.Row="0" 
Grid.Column="0" 
Grid.ColumnSpan="1" 
/>
<TextBlock
Name="PasswordTextBlock"
Grid.Row="1"
Grid.Column="0"
Text="Password"
FontSize="25"
/>
<PasswordBox
Name="Agent_Password"
Height="80"
Grid.Row="1"
Grid.Column="3"
/>
<CheckBox
Name="myCheckbox"
Grid.Row="2"
Grid.Column="0"
/>
<TextBlock 
Name="checkboxTextBlock"
Width="350"
Height="30"
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="3"
Text="Was The Agent Undercover?"
FontSize="25"
/>
<!-- Insert Radiobuttons on the next 3 rows-->     
<RadioButton
Name="radioButton_CIA"
GroupName="Agency"
Grid.Row="3"
Grid.Column="3"
/>
<TextBlock Name="ciaTextBlock" Text="CIA" Grid.Column="3" Grid.Row="3" FontSize="25" Height="30" Width="160" Tap="ciaTextBlock_Tap" />
<RadioButton
Name="radioButton_FBI"
GroupName="Agency"
Grid.Row="4"
Grid.Column="3"
/>
<TextBlock Name="fbiTextBlock" Text="FBI" Grid.Row="4" Grid.Column="3" FontSize="25" Height="30" Width="160" Tap="fbiTextBlock_Tap" />
<RadioButton
Name="radioButton_MI6"
GroupName="Agency"
Grid.Row="5"
Grid.Column="3"
/>
<TextBlock Name="mi6TextBlock" Text="MI6" Grid.Row="5" Grid.Column="3" FontSize="25" Height="30" Width="160" Tap="mi6TextBlock_Tap" />
<Button Name="enterBotton" Content="Go" Grid.Row="7" Grid.Column="3" FontSize="25" Click="enterBotton_Click"/>
<ListBox  Name="myList" Grid.Row="6" Grid.Column="0" >
<ListBoxItem Name="optionOne" Content="Find"/>
<ListBoxItem Name="optionTwo" Content="Store"/>
<ListBoxItem Name="optionThree" Content="Flip"/>
</ListBox>
</Grid>
</ScrollViewer>
</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>-->
</phone:PhoneApplicationPage>

S'Il Vous Plaît Aider Moi!

Voici le Code Derrière:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
namespace WinHomeWork2
{
public partial class MainPage : PhoneApplicationPage
{
//Constructor
public MainPage()
{
InitializeComponent();
}
private void enterBotton_Click(object sender, RoutedEventArgs e)
{
var Agent = new Agent()
{
AgentName = AgentName.Text,
Password = Agent_Password.Password,
RecordTime = DateTime.Now,
Undercover = myCheckbox.IsChecked,
Agency = getAgency()
};
}
private string getAgency()
{
return (bool)radioButton_CIA.IsChecked? "CIA" : (bool)radioButton_FBI.IsChecked ? "FBI" : (bool)radioButton_MI6.IsChecked? "MI6" : null;
}
private void ciaTextBlock_Tap(object sender, GestureEventArgs e)
{
radioButton_CIA.IsChecked = true;
}
private void fbiTextBlock_Tap(object sender, GestureEventArgs e)
{
radioButton_FBI.IsChecked = true;
}
private void mi6TextBlock_Tap(object sender, GestureEventArgs e)
{
radioButton_MI6.IsChecked = true;
}
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
AgentName.Focus();
}
}
//Agent Class
public class Agent
{
public Agent() { }
public string AgentName { get; set; }
public string Password { get; set; }
public DateTime RecordTime { get; set; }
public bool? Undercover { get; set; }
public string Agency { get; set; }
}
}
J'ai réussi à adapter le défilement de l'observateur à l'objet, mais je suis toujours avoir des problèmes à faire la page séjour dans qui a défilé en position.Dès que j'ai lâché l'écran, la page revient à sa position d'origine donc je n'ai pas la possibilité de faire quoi que ce soit.

OriginalL'auteur KillaKem | 2012-08-19