Xaml 子页面的问题';在使用帧时显示 问题
这是我的主窗格的布局:Xaml 子页面的问题';在使用帧时显示 问题,xaml,layout,uwp,uwp-xaml,Xaml,Layout,Uwp,Uwp Xaml,这是我的主窗格的布局: <Page x:Class="Communities.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:Communi
<Page
x:Class="Communities.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Communities"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" Loaded="Page_Loaded" DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="48" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
...
<SplitView Grid.Row="1" Name="hamburgerMenu" OpenPaneLength="200" PaneBackground="#F02A2A2A">
<SplitView.Pane>
<ListView ItemsSource="{Binding}" IsItemClickEnabled="True" ItemClick="HamburgerItemClick">
... </ListView>
</SplitView.Pane>
<Frame Name="frame" />
</SplitView>
<Grid Grid.RowSpan="3" Name="popupArea" />
</Grid>
</Page>
麻烦就从这里开始。它在PC上运行良好,因为桌面上的布局大多是静态的。大部分时间都不需要软件键盘等。在移动设备上,问题更大:
我的想法
用于显示子页面的框架似乎引起了各种各样的问题。在主页中定义AppBar后,它将正确定位
我想避免键盘覆盖文本框和应用程序栏,但我不想去掉框架
控件。我还希望当键盘显示时,页面被“挤压”,而不是被向上推,但我不确定如何在框架
级别显示键盘,而不是整个主页
,默认级别
解决这种情况的最好办法是什么
干杯 如您所知,如果我们在页面的根目录中设置
页面.BottomAppBar
,则触摸键盘没有问题。似乎这是添加页面的最佳方式。BottomAppBar
如果要将页面.BottomAppBar
添加到框架的另一个页面
,您应该能够自定义UI。UWP通过处理对象暴露的事件和事件,在触摸键盘的外观上提供类似的行为
我们可以使用InputPaneVisibilityEventArgs.OccludedRect
获取输入窗格覆盖的应用程序窗口区域
例如:
public PostView()
{
this.InitializeComponent();
InputPane.GetForCurrentView().Showing+=PostView\u Showing;
InputPane.GetForCurrentView().Hiding+=PostView\u Hiding;
}
私有无效后视图隐藏(InputPane发送方、InputPaneVisibilityEventArgs参数)
{
MyTextBox.Margin=新厚度(0,args.OccludedRect.Height,0,0);
}
显示私有无效后视图(InputPane发送方、InputPaneVisibilityEventArgs参数)
{
MyTextBox.Margin=新厚度(0,0,0,args.OccludedRect.Height);
}
...
<Page.BottomAppBar>
<CommandBar>
<AppBarButton Label="Back" Icon="Back" Click="TryGoBack" />
<AppBarButton Label="Refresh" Icon="Refresh" Click="TryRefreshComments" />
<AppBarButton Label="Go to Community" Icon="Go" Click="TryOpenCommunity" />
</CommandBar>
</Page.BottomAppBar>
...