Scrolling is disabled/limited when keyboard is popped up in Windows Phone 7.5

北战南征 提交于 2019-12-24 10:49:49

问题


Based on the link scrollviewer to scroll to textbox position

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

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

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

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

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.

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

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.

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.


回答1:


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

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 };

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.



来源:https://stackoverflow.com/questions/14795865/scrolling-is-disabled-limited-when-keyboard-is-popped-up-in-windows-phone-7-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!