在Windows Phone 7.5中弹出键盘时,滚动被禁用/限制 [英] Scrolling is disabled/limited when keyboard is popped up in Windows Phone 7.5

查看:73
本文介绍了在Windows Phone 7.5中弹出键盘时,滚动被禁用/限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于链接 scrollviewer滚动到文本框位置

我试图解决键盘启动时的滚动问题,但是横向模式下存在问题.

I tried to resolve scrolling issue when keyboard is launched but there is a problem in landscape mode.

使用(App.Current as App).RootFrame.RenderTransform = new CompositeTransform();的问题在横向模式下.

Problem in using (App.Current as App).RootFrame.RenderTransform = new CompositeTransform(); in landscape mode.

上述解决方案帮助我生成了与新约会"页面相似的行为,就像Windows Phone 7.5的默认日历应用程序一样.

Above solution helped me to generate a behaviour similar to New Appointment page as in the default calendar app for windows phone 7.5.

但是此(App.Current为App).RootFrame.RenderTransform = new CompositeTransform();不适用于页面的横向方向.

But this (App.Current as App).RootFrame.RenderTransform = new CompositeTransform();does not work for landscape orientation of a page.

它在potrait模式下可以正常工作,但是在更改方向(转向设备)时,页面不会自动转换为横向视图,而是页面显示与纵向视图类似,但宽度和高度已更改.

It works as expected in potrait mode, but on changing orientation(turning device), page does not automatically convert for landscape view, instead the page appears similar to portrait view with its width and height changed.

最初,我将其放置在App类中(App.Current作为App).RootFrame.RenderTransform= new CompositeTransform();

Initially i had placed this in App class (App.Current as App).RootFrame.RenderTransform = new CompositeTransform();

在纵向模式下可以正常工作.但是在横向模式下,它没有按预期工作.所以我将原始存储在App类中的静态变量中的(App.Current as App).RootFrame.RenderTransform还原为原始值,然后在方向更改的方法中分配了复合变换.这使得页面可以正确更改为横向模式.

it is Working fine in portrait mode. But in landscape mode, it did not work as expected. So i reverted to original value for (App.Current as App).RootFrame.RenderTransform which i had stored in a static variable in App class, before assigning the composite transform in orientation changed method. This made page to alter correctly for landscape mode.

现在放置(App.Current为App).RootFrame.RenderTransform= new CompositeTransform();在文本框焦点方法中,单击文本框时,横向页面会自动更改其宽度和高度,使肖像变为纵向,甚至看起来与正确的肖像视图都不相似.我不知道到底发生了什么.任何帮助都将不胜感激.

Now placed(App.Current as App).RootFrame.RenderTransform = new CompositeTransform(); in textbox focus method, on click of the textbox, landscape page turns portrait automatically with its width and height changed and doesn't even look similar to the correct portrait view. I don't know what exactly is happening. Any help could be appreciated.

任何解决此问题的想法,等待您的宝贵答复.

Any idea to fix this issue, Awaiting your valuable response.

推荐答案

在横向模式下,基于横向左"或横向右",请使用以下代码

In landscape mode, based on Landscape Left or Landscape Right, use the following code

if(orientation == PageOrientation.LandscapeLeft) (App.Current为App).RootFrame.RenderTransform= new CompositeTransform(){旋转= 90,TranslateX = 480}; 别的 (App.Current为App).RootFrame.RenderTransform= new CompositeTransform(){旋转= -90,TranslateY = 800};

if(orientation == PageOrientation.LandscapeLeft) (App.Current as App).RootFrame.RenderTransform = new CompositeTransform() { Rotation = 90, TranslateX = 480 }; else (App.Current as App).RootFrame.RenderTransform = new CompositeTransform() { Rotation = -90, TranslateY = 800 };

这也会在横向模式下正确更改您的页面.这样可以防止启动键盘时页面标题消失.滚动到scrollviewer中的特定文本框需要在特定文本框的GotFocus()事件中由ScrollToVerticaloffset()处理.

This will alter your page correctly for Landscape mode also. This will prevent page header from disappearing on launch of keyboard. Scrolling to specific textboxes inside scrollviewer needs to be handeled by ScrollToVerticaloffset() in the GotFocus() events of specific textboxes.

这篇关于在Windows Phone 7.5中弹出键盘时,滚动被禁用/限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆