2013-08-28 123 views
0

我有一个问题: 我已经在滚动视图固定高度页:滚动页面

这里是页

Page

当我弹出键盘:

enter image description here

现在键盘有50%的屏幕,我希望页面的可见部分滚动 - 如何制作。因为如果用户在页面上不带磁带 - 键盘不会关闭,某些用户将尝试滚动,直到他们到达“发送”按钮。

这里是我的XAML:什么,我希望它是什么样子,去接触的WP添加

<ScrollViewer HorizontalAlignment="Stretch" Grid.Row="1" VerticalAlignment="Stretch" Margin="0,0"> 
      <Grid Margin="0" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White"> 
       <Grid.RowDefinitions> 
        <RowDefinition Height="100"/> 
        <RowDefinition Height="auto"/> 
        <RowDefinition Height="60"/> 
        <RowDefinition Height="80"/> 
        <RowDefinition Height="60"/> 
        <RowDefinition Height="auto"/> 
        <RowDefinition Height="auto"/> 
        <RowDefinition Height="auto"/> 
        <RowDefinition Height="auto"/> 
       </Grid.RowDefinitions> 
       <Rectangle Grid.Row="0" Fill="#FFE3E2E2" Margin="0"></Rectangle> 
       <TextBlock x:Name="Comment" HorizontalAlignment="Center" Margin="10" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Center" Foreground="Black" FontSize="22"/> 
       <TextBlock Grid.Row="2" Margin="10" x:Name="FeedbackTitleLabel" HorizontalAlignment="Left" TextWrapping="NoWrap" Text="sgwrgggggg" VerticalAlignment="Center" Foreground="Black" FontSize="24"/> 
       <TextBox x:Name="FeedbackTitle" HorizontalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="3" TextWrapping="NoWrap" Text="" VerticalAlignment="Center" FontSize="24" BorderBrush="#BF7B7B7B" Background="#BFC9C9C9"/> 
       <TextBlock Margin="10" x:Name="FeedbackContentLabel" HorizontalAlignment="Left" TextWrapping="NoWrap" Text="sgrsgsrgsegsg" VerticalAlignment="Center" Grid.Row="4" Foreground="Black" FontSize="24"/> 
       <TextBox x:Name="FeedbackContent" HorizontalAlignment="Stretch" Margin="0" Grid.Row="5" TextWrapping="Wrap" Text="" VerticalAlignment="Stretch" FontSize="24" BorderBrush="#BF7B7B7B" Background="#BFC9C9C9"/> 
       <StackPanel Grid.Row="6" Orientation="Horizontal"> 
        <TextBlock Margin="10,0,10,0" x:Name="AdditionalItemsLabel" HorizontalAlignment="Left" TextWrapping="NoWrap" Text="sgsgsegsrg" VerticalAlignment="Center" Grid.Row="4" Foreground="Black" FontSize="24"/> 
        <local:Button2 Height="80" x:Name="Photo" HorizontalAlignment="Right" Margin="10" VerticalAlignment="Stretch" Width="177" Tap="Photo_Tap"/> 
       </StackPanel> 
       <local:Button3 x:Name="Send" HorizontalAlignment="Stretch" Margin="10" Height="80" Grid.Row="8" VerticalAlignment="Stretch" Tap="Send_Tap"/> 
       <Grid Margin="10" Name="AttachmentGrid" Grid.Row="7" Visibility="Collapsed"> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="60"/> 
         <RowDefinition Height="auto"/> 
        </Grid.RowDefinitions> 
        <Grid.ColumnDefinitions> 
         <ColumnDefinition Width="*"/> 
         <ColumnDefinition Width="60"/> 
        </Grid.ColumnDefinitions> 
        <TextBlock Margin="0,10,10,10" Grid.ColumnSpan="2" x:Name="AttachedFilesLabel" HorizontalAlignment="Left" TextWrapping="NoWrap" Text="sgrsgsrgsegsg" VerticalAlignment="Center" Grid.Row="0" Foreground="Black" FontSize="24"/> 
        <StackPanel Grid.Row="2" x:Name="ImageThumbs" Orientation="Horizontal"> 

        </StackPanel> 
        <Rectangle VerticalAlignment="Center" Grid.Row="0" Grid.ColumnSpan="2" Grid.RowSpan="2" Height="40" Width="40" Grid.Column="1" Fill="#FFC2C2C2" Stroke="Black" RadiusX="5" RadiusY="5" Tap="DeleteAttach_Tap"/> 
        <Image Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" Grid.Column="1" Height="30" Width="30" HorizontalAlignment="Center" VerticalAlignment="Center" Source="../*/delete.png"/> 
       </Grid> 
       <Grid Name="MessageGrid" Margin="10" Visibility="Collapsed" Grid.Row="1"> 
        <Rectangle Fill="#00A7D1" Margin="0,0,0,0" Height="80" RadiusX="5" RadiusY="5"/> 
        <TextBlock x:Name="Message" HorizontalAlignment="Center" Margin="10" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Center" Foreground="White" FontSize="22"/> 
       </Grid> 
      </Grid> 
     </ScrollViewer> 

例如,添加名称:

enter image description here

将在突出显示区域可以被滚动,我想在我的应用程序...

+0

请不要将WPF标签添加到您的Windows手机相关问题。 Windows Phone上没有WPF。 –

回答

4

我有同样的问题。但最后我解决了它,我只是使用Height属性来做到这一点。请执行以下步骤

  • 首先创建一个ScrollViewer中
  • 的球铁QT500的ScrollViewer创建一个容器(如:网格/ StackPanel中/边框等等),并把每controlls里面。为的ScrollViewer和集装箱
  • 设置固定的高度(注:容器的高度应比ScrollViewer中的高度会更大)

请参见下面的代码

<ScrollViewer Height="500"> 
     <Grid Name="Container" Height="700"> 
      <TextBox/> 
      <TextBox/> 
      <TextBox/> 
     </Grid> 
</ScrollViewer> 

现在,你甚至可以在滚动容器网显示KeyBoard,甚至关注TextBox。