如何在键盘出现时进行屏幕滚动?

时间:2016-08-26 13:01:57

标签: windows-phone-7 windows-phone-8 windows-runtime windows-phone-8.1 windows-phone

我希望在虚拟键盘出现时让我的屏幕滚动,以便我可以在隐藏在键盘后面的文本框中输入文本。 在Windows Phone 8中,无法知道键盘的高度。

当我点击文本框1键盘弹出时,现在我想通过滚动屏幕而不删除键盘在文本框4和5中输入文本。

以下是xaml代码。

    <Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>


    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
        <TextBlock Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
    </StackPanel>

    <!--ContentPanel - place additional content here-->
    <StackPanel x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <TextBox x:Name="txt1" ></TextBox>
        <TextBox x:Name="txt2" ></TextBox>
        <TextBox x:Name="txt3" ></TextBox>
        <TextBox x:Name="txt4" ></TextBox>
        <TextBox x:Name="txt5" ></TextBox>
        <TextBox x:Name="txt6" ></TextBox>




    </StackPanel>


</Grid>

before

after

0 个答案:

没有答案