[WP8] TextBox.VerticalScrollBarVisibility [英] [WP8] TextBox.VerticalScrollBarVisibility

查看:73
本文介绍了[WP8] TextBox.VerticalScrollBarVisibility的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道TextBox.VerticalScrollBarVisibility应该做什么.

I'm wondering what The TextBox.VerticalScrollBarVisibility is supposed to do.

以下内容演示了2个文本框,其中一个将VerticalScrollBarVisibility设置为可见"(TextBoxA),将一个设置为禁用"(TextBoxB):

The following demonstrates 2 TextBoxes, one with VerticalScrollBarVisibility set to visible (TextBoxA) and one set to disabled (TextBoxB):

<StackPanel>
    <TextBox x:Name="TextBoxA" 
             Height="300"
             VerticalScrollBarVisibility="Visible"
             AcceptsReturn="True"
             TextWrapping="Wrap"/>
    <TextBox x:Name="TextBoxB"
             Height="300"
             verticalScrollBarVisibility="Disabled"
             AcceptsReturn="True"
             TextWrapping="Wrap"/>
</StackPanel>

在我看来,它们的行为完全相同.我本以为TextBoxA将允许我在文本框中上下滚动.但是似乎一旦我结束的行数超出了TextBox宽度的大小,它将滚动 向下,但我无法再向上滚动...

It seems to me that they behave in exactly the same way. I would have assumed that TextBoxA would allow me to scroll up and down in the textbox. But it seem that once I end up with more lines than what can easily fit in the TextBox's width, it will scroll down, but I can no longer scroll back up...

我想要的是一个文本框,在其中可以输入比屏幕上显示的文本更多的文本,但是可以在其中返回并编辑更高"的文本.在TextBox中向下滚动.

What I want is a TextBox where I can enter more text than what fits on the screen, but where I can go back and edit text "higher up" in the TextBox after is scrolls down.

有什么建议吗?

此致

托马斯·霍夫曼(Tomas Hofmann)

Tomas Hofmann

推荐答案

TextBox确实可以滚动,但是界面是如此笨拙且不直观,以至于用户无法发现它是可能的.点击并按住文本框,直到出现编辑光标.然后,您可以将编辑光标拖到您要放置的文本中的某个位置 想开始打字.如果将编辑光标拖到TextBox顶部或底部边缘附近,将导致隐藏的文本滚动到视图中.太不直观了,开发人员无法期望用户知道如何滚动.

TextBox does actually scroll, but the interface is so awkward and unintuitive that users don't discover it is possible. Tap and hold on the TextBox until an edit cursor appears. You can then drag the edit cursor and drop it someplace in the text where you want to begin typing. If you drag the edit cursor near the top or bottom edge of the TextBox, it will cause hidden text to scroll into view. It is so unintuitive that a developer cannot expect a user to know how to scroll.

如果让TextBox在ScrollViewer中展开,效果会更好:

It works better if you let the TextBox expand inside a ScrollViewer:

    <ScrollViewer Height="200" VerticalScrollBarVisibility="Visible">
        <TextBox AcceptsReturn="True" TextWrapping="Wrap" />
    </ScrollViewer>

只需拖动即可以预期的方式滚动文本.唯一的问题是,键入时,文本不会自动滚动以保持光标位置在视图中.即使有此限制,它也比TextBox内置滚动器更好.

The text will scroll in the expected way by simply dragging. The only problem is that while typing, the text won't automatically scroll to keep the cursor position in view. Even with this limitation, it works better than the TextBox built-in scroller.


这篇关于[WP8] TextBox.VerticalScrollBarVisibility的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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