从代码后面滚动文本块中的文本
我需要滚动文本块文本。例如,文本块包含 700 个单词。这些单词从代码后面填充到文本块中,因为根据某些“内容”,它可能是不同的 700 个单词。此表单上也有一个文本框。用户将文本块中的单词键入到文本框中。当他们打字时,我会跟踪他们所在的文本块中的哪个单词。但是,并非文本块中的所有单词都适合文本块查看区域,因此我需要从代码后面滚动文本块。我该怎么做呢?
我正在使用 silverlight 3。
谢谢 香农
抱歉..我没有意识到我没有在它自己的线程上问这个问题..我会再次发帖..
i need to scroll the textblock text. For example, the textblock contains 700 words. These words are populated to the textblock from code behind as it could be a different 700 words depending on some "stuff". There is a textbox on this form as well. The user types the words in the textblock into the textbox. As they type i keep track of which word from the textblock they are on. However, not all the words in the textblock will fit in the textblock viewing area, so i need to scroll the textblock from code behind. How do i go about doing this.
I"m using silverlight 3.
Thanks
shannon
sorry.. i didn't realize i didn't ask the question on it's own thread.. I'll post again..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您需要将 TextBlock 包装在 ScrollViewer 控件中。此时,您可以在后面的代码中设置 ScrollViewer 的垂直和水平偏移,如下所示。请注意,这假定 ScrollViewer 控件名为 ScrollViewer1。
First you'll want to wrap your TextBlock in a ScrollViewer control. At that point, you can set the vertical and horizontal offsets of the ScrollViewer in the code behind like this. Note this assumes a ScrollViewer control named ScrollViewer1.