Robert Oschler
Robert Oschler

Reputation: 14375

Why does the appearance of the Windows Phone 8 virtual keyboard screw up my page layout?

I have a C# Windows Phone app with a ComponentOne rich text box as the main content element. If there's enough text in the text box that some of it scrolls out of view when the virtual keyboard rolls up, the text box shrinks in size, not temporarily, permanently. I don't have any sizechanged event handlers or anything like that at all. Note, if the amount of text in the rich text box does not result in the any text getting pushed vertically off the screen when the virtual keyboard appears, than the problem does not occur.

Here's the XAML for the page:

<phone:PhoneApplicationPage
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:SpeechRecoControl="clr-namespace:SpeechRecoControl.Controls;assembly=SpeechRecoControl_WP8" 
            xmlns:RichTextBox="clr-namespace:C1.Phone.RichTextBox;assembly=C1.Phone.RichTextBox.8"
            xmlns:UserControls="clr-namespace:VoiceEditBox_WP8.UserControls;assembly=VoiceEditBox_WP8" x:Name="rootFrame"
            x:Class="SuperNote.Pages.NoteEntry"
            FontFamily="{StaticResource PhoneFontFamilyNormal}"
            FontSize="{StaticResource PhoneFontSizeNormal}"
            Foreground="{StaticResource PhoneForegroundBrush}"
            SupportedOrientations="Portrait" Orientation="Portrait"
            mc:Ignorable="d"
            shell:SystemTray.IsVisible="True"
            DataContext="{Binding Source={StaticResource Locator}, Path=Main}"    
            >

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--TitlePanel contains the name of the application and page title-->

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Margin="12,0,12,0">
            <UserControls:VoiceEditBox x:Name="vebNote"  />
        </Grid>
    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar x:Name="appbarMain" IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="btnUndo" IconUri="/Assets/Images/Icons/Command-Undo.png" Text="Undo" Click="btnUndo_Click"  />
            <shell:ApplicationBarIconButton x:Name="btnRedo" IconUri="/Assets/Images/Icons/Command-Redo.png" Text="Redo" Click="btnRedo_Click" />
            <shell:ApplicationBarIconButton x:Name="btnMicrophone" IconUri="/Assets/Images/Icons/turn-microphone-on.png" Text="Turn Mic On" Click="btnMicrophone_Click"/>
            <shell:ApplicationBarIconButton x:Name="btnSelection" IconUri="/Assets/Images/Icons/Text-Normal.png" Text="Select" Click="btnSelection_Click"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem x:Name="menuitemAttachPhoto" Text="Attach Photo" Click="menuitemAttachPhoto_Click"/>
                <shell:ApplicationBarMenuItem x:Name="menuitemViewAttachments" Text="View Attachments" Click="menuitemViewAttachments_Click" />
                <shell:ApplicationBarMenuItem x:Name="menuitemHelp" Text="Help"/>
                <shell:ApplicationBarMenuItem x:Name="menuitemTest" Text="Test" Click="menuitemTest_Click"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage

Upvotes: 1

Views: 217

Answers (0)

Related Questions