I came across a rather unusual effect in the windows phone keypad
, in the portrait mode
. I have a textbox
at the bottom of my grid
, and below it is the app bar
. Now when the text box gains focus, There is an unnecessary spacing between the textbox and the keypad
. I have pointed it out in this pic
.
Also here is my code,
<Grid x:Name="LayoutRoot" Background="Green">
<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-->
<Grid Background="PeachPuff" x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*" MaxHeight="100"/>
</Grid.RowDefinitions>
<ScrollViewer x:Name="scrollthis">
<StackPanel x:Name="mystack"/>
</ScrollViewer>
<TextBox InputScope="Search" Grid.Row="1" x:Name="myTextBox"/>
</Grid>
<!--Uncomment to see an alignment grid to help ensure your controls are
aligned on common boundaries. The image has a top margin of -32px to
account for the System Tray. Set this to 0 (or remove the margin altogether)
if the System Tray is hidden.
Before shipping remove this XAML and the image itself.-->
<!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />-->
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="enter text" Click="ApplicationBarIconButton_Click_1"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
On app bar click I do the following.
private void ApplicationBarIconButton_Click_1(object sender, EventArgs e)
{
TextBlock text = new TextBlock() { Text = myTextBox.Text, Margin = new Thickness(0,0,0,5) };
myTextBox.Text = "";
mystack.Children.Add(text);
}
If this is an OS bug, should I look for a hack? Also please note that this spacing is not there in the landscape mode.
UPDATE
I just found out it happens only when there is an app bar
at the bottom in the portrait mode.
UPDATE
I also noticed one more thing, initially even if I handle the grid margins, after entering some text, the spacing starts to grow.
This was a bug which got fixed in GDR 3 Update.