2012-03-01 19 views
3

グリッドに含まれているスタックパネルのコレクションには、たくさんのコントロールがあります。私はscrollviewerに入れているので、グリッドはかなり長いとページを実行します。すべてが完璧に動作し、キーボードがアクティブになるまでページを上下にスクロールできます。一度それが起こると、テキストボックスがハイライト表示されているときにコンテンツを一番下までスクロールすることができません。私はある程度までスクロールすることができますが、下方向にスクロールすることはできません。私は何か間違っているのですか?次のように私のコードは次のとおりです。オンスクリーンキーボードがアクティブなとき、一番下までスクロールできない

<ScrollViewer Margin="12,0,12,0" Grid.Row="1"> 
     <!--ContentPanel - place additional content here--> 
     <Grid x:Name="ContentPanel" Height="837" Width="456">     
      <StackPanel HorizontalAlignment="Left" Width="450" Margin="0,63,0,405"> 
       <TextBlock Height="30" Name="tBlk_Username" Text="Display Name" /> 
       <TextBox Height="71" Name="tb_UserNameVal" Text="{Binding UserNameValue, Mode=TwoWay}" Width="452" /> 
       <TextBlock Height="30" Name="tBlk_Email" Text="Email" /> 
       <TextBox Height="71" Name="tb_EmailVal" Text="{Binding EmailValue, Mode=TwoWay}" Width="452" /> 
       <TextBlock Height="30" Name="tBlk_Message" Text="Message" /> 
       <TextBox Height="130" Name="tb_MessageVal" Text="{Binding MessageValue, Mode=TwoWay}" Width="452" /> 
      </StackPanel> 
      <StackPanel Height="37" HorizontalAlignment="Left" Margin="0,519,0,0" Name="stackPanel2" 
         VerticalAlignment="Top" Width="450"> 
       <TextBlock Height="30" Name="tBlk_PicInfo" Text="Include a Photo" /> 
      </StackPanel> 
      <StackPanel Orientation="Horizontal" Height="90" HorizontalAlignment="Left" Margin="12,432,0,0" 
         Name="stackPanel1" VerticalAlignment="Top" Width="450" d:LayoutOverrides="GridBox"> 
       <TextBox Height="71" Name="tb_Location" Text="{Binding Location}" Width="367" IsReadOnly="True" /> 
       <Button Height="60" Name="btn_Clear" Width="60" BorderThickness="0" Background="{Binding LocationImage}" Style="{StaticResource LocationButtonStyle}"> 
        <i:Interaction.Triggers> 
         <i:EventTrigger EventName="Click"> 
          <GalaSoft_MvvmLight_Command:EventToCommand x:Name="ClearCommand" Command="{Binding ClearCommand}"/> 
         </i:EventTrigger> 
        </i:Interaction.Triggers> 
       </Button> 
      </StackPanel> 
      <StackPanel Orientation="Horizontal" Height="205" HorizontalAlignment="Left" Margin="12,556,0,0" 
         Name="stackPanel3" VerticalAlignment="Top" Width="452" d:LayoutOverrides="GridBox"> 
       <Image Name="img_FlickrPic" Stretch="Fill" Width="260" Source="{Binding Capture}" Margin="0,13,0,0" /> 
       <Button Name="btn_Capture" Width="90" Height="90" Margin="0,67,0,55" BorderThickness="0"> 
        <Button.Background> 
         <ImageBrush ImageSource="/Images/camera.png" /> 
        </Button.Background> 
        <i:Interaction.Triggers> 
         <i:EventTrigger EventName="Click"> 
          <GalaSoft_MvvmLight_Command:EventToCommand x:Name="CaptureClick" Command="{Binding CaptureCommand}"/> 
         </i:EventTrigger> 
        </i:Interaction.Triggers>       
       </Button> 
      </StackPanel> 
      <StackPanel Orientation="Horizontal" Height="100" HorizontalAlignment="Left" 
         Margin="4,763,0,0" Name="stackPanel4" VerticalAlignment="Top" Width="450" d:LayoutOverrides="GridBox"> 
       <Button Content="Submit" Height="71" Name="btn_Submit" Width="130" IsEnabled="{Binding SubmitEnabled}"> 
        <i:Interaction.Triggers> 
         <i:EventTrigger EventName="Click"> 
          <GalaSoft_MvvmLight_Command:EventToCommand x:Name="SubmitCommand" Command="{Binding SubmitCommand}"/> 
         </i:EventTrigger> 
        </i:Interaction.Triggers> 
       </Button> 
      </StackPanel> 
      <StackPanel Height="59" HorizontalAlignment="Left" Name="stackPanel5" VerticalAlignment="Top" Width="456" Orientation="Horizontal"> 
       <TextBlock FontFamily="{StaticResource HelveticaNeue}" Name="tBlk_StepConf" Text="Please share my " Width="150" TextAlignment="Center" Height="33" /> 
       <TextBlock FontFamily="{StaticResource HelveticaNeue}" Foreground="#FF00BCE4" Name="tBlk_StepConfCount" Text="{Binding StepVal}" Width="56" FontSize="34" TextAlignment="Center" VerticalAlignment="Top" /> 
       <TextBlock FontFamily="{StaticResource HelveticaNeue}" Name="tBlk_StepConfTrail" Text=" steps for water" Width="134" TextAlignment="Center" Height="40" /> 
      </StackPanel> 
     </Grid> 
    </ScrollViewer> 
+0

ScrollViewerの行のRowDefinitionは何ですか?クレイジーマージンと高さの値が定義されています。RowDefinitionsとColumnDefinitionsを使用してクリーナー全体を処理し、問題を解決できました。 –

+0

RowDefinitionは、スクロールビューワが内部に置かれているlayoutrootグリッドの一部です。 あなたはその実際の行にしてコンテンツグリッド内stackpanelsを置く意味私はそのグリッドを定義しますか?うーん...それはコンテンツの垂直方向のスパンに影響するでしょうか? – Cranialsurge

+0

値をハードコードすると、アプリはすべての状況で機能しません。たとえば、風景をサポートすることに決めました。さて、あなたのフィールドは、すべての方法で伸びることはありません。あなたは452pxにハードコードしました。 –

答えて

0

問題はそれだけであれば、キーボードの後ろいわばできるようにスクロールしてScrollViewerのは、ソフト入力パネル(またはキーボード)に注意を払っていないということです。

単純な解決策は、ScrollViewerのコンテンツコントロールの下部に余白を追加することです。

もっと長く複雑な解決策は、SIPが表示されているときに余白を追加することです。残念ながらthere's no event for itだが、テキストボックスにフォーカスがあるときは耳を傾けることができて、余白を設定したり、テキストボックスにフォーカスがあるとき(したがってSIPが表示されているときに)ページの下部にコントロールを表示して、それはしません。

関連する問題