【问题标题】:Scrolling is disabled/limited when keyboard is popped up in Windows Phone 7.5在 Windows Phone 7.5 中弹出键盘时,滚动被禁用/限制
【发布时间】:2013-02-10 08:03:49
【问题描述】:

基于链接scrollviewer to scroll to textbox position

我尝试解决键盘启动时的滚动问题,但横向模式出现问题。

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

上述解决方案帮助我生成了类似于 Windows Phone 7.5 的默认日历应用中的“新约会”页面的行为。

但这 (App.Current as App).RootFrame.RenderTransform = new CompositeTransform(); 不适用于横向页面。

它在纵向模式下按预期工作,但在改变方向(转动设备)时,页面不会自动转换为横向视图,而是页面看起来类似于纵向视图,其宽度和高度发生了变化。

最初我把它放在 App 类中 (App.Current as App).RootFrame.RenderTransform = new CompositeTransform();

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

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

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

【问题讨论】:

    标签: windows-phone-7 xaml keyboard silverlight-toolkit scrollviewer


    【解决方案1】:

    横屏模式下,基于Landscape Left或Landscape Right,使用如下代码

    如果(方向 == PageOrientation.LandscapeLeft) (App.Current as App).RootFrame.RenderTransform = new CompositeTransform() { Rotation = 90, TranslateX = 480 }; 别的 (App.Current as App).RootFrame.RenderTransform = new CompositeTransform() { Rotation = -90, TranslateY = 800 };

    这也将在横向模式下正确更改您的页面。这将防止页眉在启动键盘时消失。在scrollviewer中滚动到特定文本框需要通过特定文本框的GotFocus()事件中的ScrollToVerticaloffset()来处理。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-10
      • 1970-01-01
      • 2012-04-16
      • 1970-01-01
      相关资源
      最近更新 更多