0

我正在制作一个应用程序,我想在键盘打开时调整屏幕区域的大小。就像在这个 windows phone 的日历应用程序中一样。

打开键盘后,外观屏幕应该调整大小,并且我应该能够滚动到页面末尾而无需关闭键盘:

在此处输入图像描述

在我的应用程序中,我无法做这些事情。在我的页面中,页面的最后一个元素留在键盘后面,如果我想访问页面的那个元素,我必须关闭键盘,但在诺基亚的日历应用程序中,通过以某种方式调整页面大小,我可以访问整个页面,甚至可以访问页面的整个部分。虽然键盘是打开的。

有人可以帮我解决这个问题吗?

http://i.stack.imgur.com/aWgTA.png

这是我的页面的代码

<!--TitlePanel contains the name of the application and page title-->
    <StackPanel Grid.Row="0" Style="{StaticResource HeaderStackPanelStyle}">
        <TextBlock TextAlignment="Center" Style="{StaticResource PhoneTextBlockHeaderStyle}" Text="Add Claim Item" />
      </StackPanel>
    <ScrollViewer Name="MainPageScroller" Grid.Row="1">
        <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel"  Margin="12,0,12,12">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>

            </Grid.RowDefinitions>
        <StackPanel Name="MainContentPenal" Grid.Row="0">
            <StackPanel  >
                    <TextBlock TextAlignment="Left" Text="Category" Style="{StaticResource PhoneTextFirstItemStyle}" >    
                    </TextBlock>
                    <ToolKit:ListPicker x:Name="CategoryListPicker" 
                                        ItemsSource="{Binding Categories}"  SelectedItem="{Binding SelectedCategory, Mode=TwoWay}" SelectedIndex="{Binding Categories,Converter={StaticResource DefaultSetter}}"
                                         ExpansionMode="FullScreenOnly" SelectionMode="Single"  HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"   SelectionChanged="CategorySelection" ItemTemplate="{StaticResource CategoryTamplate}"  FullModeItemTemplate="{ StaticResource CategoryTamplate}"  >

                    </ToolKit:ListPicker>
             </StackPanel  >
                <StackPanel Visibility="{Binding SelectedCategory, Converter={StaticResource TravelMileageHelper}, ConverterParameter=amount}" >
                    <TextBlock TextAlignment="Left" Text="Amount" Style="{StaticResource PhoneTextFirstItemStyle}" />
                    <TextBox x:Name="AmountTextBox"  Style="{StaticResource WebExpensesTextBoxStyle}" Text="{Binding Amount, Mode=TwoWay}"  KeyUp="numericTextBox_keyUp" KeyDown="numericTextBox_keyDown"  InputScope="Number" TextChanged="TextChange_Event" />
                </StackPanel>
                <StackPanel Visibility="{Binding SelectedCategory, Converter={StaticResource TravelMileageHelper},ConverterParameter=mileage}"  >

                    <TextBlock TextAlignment="Left" Text="Mileage units" Style="{StaticResource PhoneTextFirstItemStyle}" />
                    <TextBox x:Name="mileageTextBox" Text="{Binding MileageUnit, Mode=TwoWay}"  Style="{StaticResource WebExpensesTextBoxStyle}"  KeyUp="numericTextBox_keyUp" KeyDown="numericTextBox_keyDown" TextWrapping="Wrap" InputScope="Number"  TextChanged="TextChange_Event"/>
                </StackPanel>
                <StackPanel Visibility="{Binding SelectedCategory, Converter={StaticResource TravelMileageHelper}, ConverterParameter=trip}" >
                    <TextBlock TextAlignment="Left" Text="Mileage" Style="{StaticResource PhoneTextFirstItemStyle}" />
                    <Button Content="Add mileage" Click="AddMileage"/>
                </StackPanel>
                <StackPanel  Visibility="{Binding SelectedCategory,Converter={StaticResource TravelMileageHelper}, ConverterParameter=trip}"  >
                    <StackPanel Visibility="{Binding TripMasterModel, Mode=TwoWay, Converter={StaticResource VisibiltyHelper}}">
                        <Grid  DataContext="{Binding TripMasterModel}">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <StackPanel Grid.Row="0" Grid.Column="0">
                                <TextBlock TextWrapping="Wrap" HorizontalAlignment="Left" Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Start}"></TextBlock>
                            </StackPanel>
                            <StackPanel Grid.Row="0" Grid.Column="1">
                                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="&#xE111;" FontFamily="Segoe UI Symbol" Style="{StaticResource PhoneTextNormalStyle}"/>
                            </StackPanel>
                            <StackPanel Grid.Row="0" Grid.Column="2">
                                <TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Text="{Binding End}"></TextBlock>
                            </StackPanel>
                            <StackPanel Grid.Row="0" Grid.Column="3">
                                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding Distance}"/>
                            </StackPanel>
                            <StackPanel Visibility="{Binding subTrips,Converter={StaticResource VisibiltyHelper}}" Grid.Row="1" Orientation="Horizontal" Grid.ColumnSpan="4" >
                                <TextBlock HorizontalAlignment="Left" Text="via"/>
                                <ItemsControl  ItemsSource="{Binding subTrips}" ItemTemplate="{StaticResource SubTripTemplate}" HorizontalAlignment="Left">
                                    <ItemsControl.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <StackPanel Orientation="Horizontal"/>

                                        </ItemsPanelTemplate>
                                    </ItemsControl.ItemsPanel>
                                </ItemsControl>
                            </StackPanel>
                        </Grid>
                    </StackPanel>
                </StackPanel>
                <StackPanel   >
                    <TextBlock TextAlignment="Left" Text="Description" Style="{StaticResource PhoneTextFirstItemStyle}" />
                    <TextBox x:Name="DescriptionTextBox"  Style="{StaticResource WebExpensesTextBoxStyle}" Text="{Binding Description, Mode=TwoWay}" Height="120" TextWrapping="Wrap"  TextChanged="TextChange_Event" KeyDown="DescriptionTextBox_KeyDown"/>
                </StackPanel>

                <StackPanel  >
                    <ToolKit:DatePicker  HeaderTemplate="{StaticResource DatePickerHeader}"   Value="{Binding SelectedDate,Mode=TwoWay}" ValueStringFormat="{Binding DateFormat}"  HorizontalAlignment="Left"  x:Name="DatePicker" VerticalAlignment="Top"  Width="200"    />
                </StackPanel>
                <StackPanel Visibility="{Binding Currencies, Converter={StaticResource VisibiltyHelper}}" >
                    <TextBlock TextAlignment="Left" Text="Currency" Style="{StaticResource PhoneTextFirstItemStyle}" />
                    <ToolKit:ListPicker x:Name="CurrencyListPicker"
               ItemsSource="{Binding Currencies}" SelectedItem="{Binding SelectedCurrency, Mode=TwoWay}"
               DisplayMemberPath="Name" SelectedIndex="{Binding Currencies,Converter={StaticResource DefaultSetter}}"  FullModeItemTemplate="{ StaticResource CurrencyTamplate}"  >
                    </ToolKit:ListPicker>
                </StackPanel>
                <StackPanel Visibility="{Binding Clients, Converter={StaticResource VisibiltyHelper}}" >
                    <TextBlock TextAlignment="Left" Text="Client" Style="{StaticResource PhoneTextFirstItemStyle}"/>
                    <ToolKit:ListPicker x:Name="ClientListPicker"
               ItemsSource="{Binding Clients}" SelectedItem="{Binding SelectedClient, Mode=TwoWay}"
               ItemTemplate="{StaticResource ShowMember}" SelectedIndex="{Binding Clients,Converter={StaticResource DefaultSetter}}" FullModeItemTemplate="{ StaticResource ClientTemplate}" >
                    </ToolKit:ListPicker>
                </StackPanel>
                <StackPanel Visibility="{Binding SubClients, Converter={StaticResource VisibiltyHelper}}" >
                    <TextBlock TextAlignment="Left" Text="Subclient" Style="{StaticResource PhoneTextFirstItemStyle}"/>
                    <ToolKit:ListPicker x:Name="SubClientListPicker"
               ItemsSource="{Binding SubClients,Mode=TwoWay}"
               DisplayMemberPath="Name" SelectedItem="{Binding SelectedSubclient, Mode=TwoWay}" SelectedIndex="{Binding SubClients,Converter={StaticResource DefaultSetter},Mode=TwoWay}" FullModeItemTemplate="{ StaticResource ClientTemplate}" >
                    </ToolKit:ListPicker>
                </StackPanel>
                <StackPanel  Visibility="{Binding Vendors, Converter={StaticResource VisibiltyHelper}}"  >
                    <TextBlock TextAlignment="Left" Text="Vendor" Style="{StaticResource PhoneTextFirstItemStyle}"/>
                    <ToolKit:ListPicker x:Name="VendorListPicker"
               ItemsSource="{Binding Vendors}" SelectedItem="{Binding SelectedVendor, Mode=TwoWay}"
               DisplayMemberPath="Name" SelectedIndex="{Binding Vendors,Converter={StaticResource DefaultSetter}}"  SelectionChanged="vendorSelection"  FullModeItemTemplate="{ StaticResource ClientTemplate}" >
                    </ToolKit:ListPicker>
                </StackPanel>
                <StackPanel >
                    <TextBlock TextAlignment="Left" Text="Receipt" Style="{StaticResource PhoneTextFirstItemStyle}"/>
                    <Button Click="AddReceipt_Btn_Click" Content="Add receipt"/>
                </StackPanel>
                <StackPanel x:Name="ImagePenal">
                    <ItemsControl Width="Auto" HorizontalAlignment="Stretch" ItemsSource="{Binding ReceiptList}" ItemTemplate="{StaticResource ImageListTemplate}" >
                    </ItemsControl>
                </StackPanel>
            </StackPanel>

        </Grid>

    </ScrollViewer>
4

1 回答 1

0

ListBox在或之间给出您的内容ScrollViewer

<ListBox>
//your textbox and everything
</ListBox>

或者

<ScrollViewer>
//your textbox and everything
</ScrollViewer>
于 2013-09-18T12:23:58.977 回答