Windows phone 7 keyboard size

2019-02-25 15:12发布

问题:

I want to resize the page when the keyboard appears on the screen.

I was looking for any clue all day but I can't find anything.

In my case. I want to have full page TextBox and some buttons under it.

<Grid x:Name="RootLayout" >

    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="70"/>
        </Grid.RowDefinitions>

        <ScrollViewer Margin="0" >
            <TextBox TextWrapping="Wrap" Text="TextBox" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" Height="698" Width="480"/>
        </ScrollViewer>

        <Canvas x:Name="RootMenu" Margin="0,1,0,0" Grid.Row="1" />
    </Grid>

</Grid>

I use to thing that the first row will change its size automatically, but it doesn't happening.

Please help me.

///// -----------------------------------------------------------------------------

I'm going to dislike this OS! Proposed solution is not good at all. When the keyboard is visible then I can not scroll it down.

Lets say I want just simple TextBox to let users write something. But it is impossible !!

<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True">
        <shell:ApplicationBarIconButton IconUri="/icons/appbar.check.rest.png" Text="aplay"/>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

<Grid x:Name="RootLayout" >
    <ScrollViewer>
        <TextBox  Text="TextBox" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" />
    </ScrollViewer>
</Grid>

回答1:

There isn't a way to know for sure if the SIP is displayed. Jaime Rodriguez has a post showing how to make a fairly reliable guess of this.

If you want to have "buttons" that are always displayed then the best, and only reliable, way to do this is to use the ApplicationBar.