2013-08-28 44 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。