我已经尝试了以下步骤:我尝试在 FlipView 模板中的 ScrollViewer 上启用垂直滚动 - 这不起作用,因为 FlipView 似乎覆盖了 OnApplyTemplate(或其他东西)中的相应值 - 当 FlipView 的 VirtualizingStackPanel 上的 Orientation 时,VerticalScrollMode 被禁用设置为水平.如上所述,我尝试仅在 ScrollViewer(工作正常)甚至没有 ScrollViewer(工作正常)中显示完全相同的视图.我还检查了 ScrollViewer.BringIntoViewOnFocusChanged 但这并没有改变任何东西(此外,此属性的默认值设置为 true).有什么办法可以绕过这个问题吗?非常感谢您的帮助! 解决方案 我找到了导致问题的组件:它是 VirtualizingStackPanel 用作 FlipView 中的项目宿主.如果与普通的StackPanel 交换,那么当软键盘弹出时,输入控件会按预期转换到剩余的视口.您可以使用以下方法交换VirtualizingStackPanel:只需像这样直接在 FlipView 上设置 ItemsPanel 属性:<FlipView.ItemsPanel><ItemsPanelTemplate><StackPanel Orientation="Horizontal" AreScrollSnapPointsRegular="True"/></ItemsPanelTemplate></FlipView.ItemsPanel></FlipView>如果你有多个 FlipView,在它们之间共享一个样式更合适:<Setter Property="ItemsPanel"><Setter.Value><ItemsPanelTemplate><StackPanel Orientation="Horizontal" AreScrollSnapPointsRegular="True"/></ItemsPanelTemplate></Setter.Value></Setter></风格>请注意,在这种情况下,您将失去 UI 虚拟化,这通常意味着加载 FlipView 控件需要更长的时间,尤其是当您在其中显示大量项目时.更新:我写了一篇关于这个问题的博客文章 - 阅读更多关于 http://www.feo2x.com/posts/2015-12-06-flipview-and-problems-with-input-controls-第 1 部分/Please consider the following XAML:<Page x:Class="InputControlsInScrollViewer.WindowsStoreApp.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:l="using:InputControlsInScrollViewer.WindowsStoreApp" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <Page.Resources> <Style x:Key="FlipViewItemStyle" TargetType="FlipViewItem"> <Setter Property="Background" Value="Transparent" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Stretch" /> <Setter Property="TabNavigation" Value="Local" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="FlipViewItem"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> <ScrollViewer IsTabStop="True" ZoomMode="Disabled" VerticalScrollMode="Enabled" HorizontalScrollMode="Disabled" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" IsVerticalRailEnabled="True"> <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> </ScrollViewer> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </Page.Resources> <Page.DataContext> <l:MainPageViewModel /> </Page.DataContext> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <FlipView Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" ItemsSource="{Binding Views}" ItemContainerStyle="{StaticResource FlipViewItemStyle}" /> </Grid></Page>In it, I have a FlipView which operates in horizontal mode. The content I want to display in the FlipView is too large - that's why I added a ScrollViewer to the FlipViewItem template so that the user can scroll vertically (please note that the FlipView template uses a horizontal ScrollViewer internally).The content that is displayed by the FlipView contains input controls like text boxes and obviously, the soft keyboard is shown when the user taps the text box (so that it gets focused).Here is my actual question: why is the text box not translated into the remaining view port that is not obscured by the soft keyboard (see images)Obviously, this has to do something with the FlipView because when I display my Example View only in a ScrollViewer (or even with no ScrollViewer at all), then the text box is translated correctly when the soft keyboard pops up.I have already tried the following steps:I tried to enable vertical scrolling on the ScrollViewer that is in the FlipView's template - this doesn't work because FlipView seems to overwrite the corresponding values in OnApplyTemplate (or something) - the VerticalScrollMode is disabled when Orientation on the FlipView' VirtualizingStackPanel is set to Horizontal.As mentioned above, I tried to display the exact same view just within a ScrollViewer (which worked fine) or even without a ScrollViewer (which also worked fine).I also check ScrollViewer.BringIntoViewOnFocusChanged but this doesn't change anything (and besides, this property has its default value set to true).Is there any way that I can circumvent this problem?Thank you so much for your help in advance! 解决方案 I found the component that's causing the issue: it is the VirtualizingStackPanel that is used as the items host in the FlipView. If you exchange it with a normal StackPanel, then the input controls are translated to the remaining view port as expected when the soft keyboard pops up.You can exchange the VirtualizingStackPanel using the following methods:Just set the ItemsPanel property on the FlipView directly like this:<FlipView> <FlipView.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" AreScrollSnapPointsRegular="True" /> </ItemsPanelTemplate> </FlipView.ItemsPanel></FlipView>If you have several FlipViews, sharing a style between them is more appropriate:<Style x:Key="MyFlipViewStyle" TargetType="FlipView"> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" AreScrollSnapPointsRegular="True" /> </ItemsPanelTemplate> </Setter.Value> </Setter></Style>Please note that you will lose UI Virtualization in this case, which usually means that it takes longer to load the FlipView control, especially if you dislay a large amount of items in it.Update: I wrote a blog article about this problem - read more on http://www.feo2x.com/posts/2015-12-06-flipview-and-problems-with-input-controls-part-1/ 这篇关于为什么 FlipView 中包含的文本框在弹出时被软键盘遮挡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-29 22:20