[英]WPF win8 tablet mode the keyboard hide the item on the bottom of the screen
我目前正在使用WPF和WIN8表模式设计一些软件。
有些地方需要输入一些数字使用Textbox 。
我用某种方式最终显示键盘: http : //brianlagunas.com/showing-windows-8-touch-keyboard-wpf/
但是我发现,有时键盘会在它出现后覆盖底部或中间的某些项目 。
例如:我在屏幕上有5个文本框
<Grid>
<TextBox HorizontalAlignment="Left" Margin="500,95,0,0" Height="23" Width="120"/>
<TextBox HorizontalAlignment="Left" Margin="500,295,0,0" Height="23" Width="120"/>
<TextBox HorizontalAlignment="Left" Margin="500,495,0,0" Height="23" Width="120"/>
<TextBox HorizontalAlignment="Left" Margin="500,695,0,0" Height="23" Width="120"/>
<TextBox HorizontalAlignment="Left" Margin="500,800,0,0" Height="23" Width="120"/>
</Grid>
但现在我发现键盘是否专注于某些不在顶部的文本框,可能在中间或者可能在底部。 键盘将覆盖它。 我甚至看不到我在输入的内容 。(如图片所示)
那么有什么好方法可以解决它吗? 谢谢。
PS:我试图拖动键盘,但看起来它不是一个好的解决方案,因为中间的一些文本框,键盘仍将覆盖中间的哪个文本框。
键盘可以被用户移动使用,以便它不会覆盖。 最好让用户以这种方式处理这种情况,而不是尝试重新设计Windows体验
为了使这成为可能,你必须做类似的事情。
1)您的视图必须可滚动(在滚动查看器内)
2)textbox.BringIntoView()通常会工作,但是使用当前的解决方案..这是不可能的,因为键盘节目是在textbox.BringIntoView()之后调用的...
在此主题中查看我的帖子在WPF中显示和隐藏Windows 8屏幕键盘
这是一个完整的实现,在文本框聚焦时显示/隐藏win 8键盘和自动对焦,并保留使用inkDisableHelper时丢失的所有wpf触摸功能
当键盘显示时,虚拟键盘应该自动将聚焦的TextBox移动到视图中EnsuredFocusedElementInView
说这种行为是自动的,但可以用EnsuredFocusedElementInView
覆盖( 这里的例子 )
我认为这可以通过调整Y过渡来解决
_offSet = 0;
Windows.UI.ViewManagement.InputPane.GetForCurrentView().Showing += (s, args) =>
{
_offSet = (int)args.OccludedRect.Height;
args.EnsuredFocusedElementInView = true;
var trans = new TranslateTransform();
trans.Y = -_offSet;
this.RenderTransform = trans;
};
Windows.UI.ViewManagement.InputPane.GetForCurrentView().Hiding += (s, args) =>
{
var trans = new TranslateTransform();
trans.Y = 0;
this.RenderTransform = trans;
args.EnsuredFocusedElementInView = false;
};
在构造函数内部。
你也可以看看
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.