在文本框中滚动 [英] Scrolling in a Textbox

查看:67
本文介绍了在文本框中滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WP7应用程序,并且有一个包含大型多行文本框的页面,可以容纳大量文本。当屏幕上有多个文本时,浏览该文本(当虚拟键盘打开时,这个文本并不是很多)非常麻烦,无论我做什么都会感到毛躁的

I have a WP7 app and there is a page with a large multiline textbox that can hold a lot of text. Navigating that text when there's more than will fit on the screen (which isn't a whole lot when the virtual keyboard is open) is very cumbersome and feels glitchy no matter what I do.

通常在WP7中,您可以通过长按并将光标移动到顶部或底部来滚动这些框。在我的情况下,这似乎无法正常工作,因为文本框的顶部和/或底部可能偏离屏幕的可见部分。

Normally in WP7 you scroll through these boxes by long-pressing and moving the cursor to the top or bottom. That doesn't appear to work correctly in my case because the top and/or bottom of the textbox could be off the visible portion of the screen.

例如,如果您位于文本框的顶部,则向下滚动需要将光标一直移动到屏幕底部,这将被屏蔽虚拟键盘。它确实有效,但你必须拖过键盘顶部
才能做到这一点。如果您位于文本框的底部,让小滚动箭头显示在顶部意味着手动将焦点向上移动一两行,逐渐向上移动视口,直到文本框的顶部最终变为可见,在
,你可以激活滚动箭头。

For example, if you're at the top of the textbox, scrolling down requires moving the cursor all the way to the bottom of the screen, which is covered up by the virtual keyboard. It does work, but it's weird that you have to drag past the top of the keyboard to do it. If you're at the bottom of the textbox, getting the little scroll arrow to appear at the top means manually moving the focus up a line or two at a time which nudges the viewport up gradually until the top of the textbox finally becomes visible, at which point you can activate the scrolling arrow.

我搜索了论坛,有些人建议在Scrollviewer中包装文本框,但这也会产生奇怪的结果。最值得注意的是,当在框的底部键入时,当前行不会自动滚动到视图中,并且它将换行到
a新行。

I searched the forums and some people suggest wrapping the textbox in a Scrollviewer, but that also gives strange results. Most notably, the current line won't be automatically scrolled into view when typing at the bottom of the box and it wraps over to a new line.

是否有人想出了在Windows Phone中处理大文本框的正确方法?

Has anybody figured out the proper way to handle a large textbox in Windows Phone?

推荐答案

考虑使用  RichTextBox   -
它内置了这种行为。


这篇关于在文本框中滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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