滚动一个非常大的TextBlock [英] Scrolling a very big TextBlock

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

问题描述

论坛,

我想要显示非用户可编辑的文字,大约有200,000个字符值得精确。 我想将它粘贴在ScrollViewer的TextBlock中,但滚动非常非常慢。 我在下面有以下XAML:

I have non-user-editable text I'd like to show, about 200,000 characters worth to be precise.  I wanted to stick it in a TextBlock in a ScrollViewer, but it's very, very slow to scroll.  I have the following XAML below:

<Grid Name="grdMain" Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <ScrollViewer Height="{Binding Path=ActualHeight, ElementName=grdMain}"
                      Width="{Binding Path=ActualWidth, ElementName=grdMain}">
            <TextBlock Name="txtOutput" TextWrapping="Wrap"
                       FontSize="18" >
                
            </TextBlock>
        </ScrollViewer>
    </Grid>

切换到TextBox会让它更快。 我想知道这是否是TextBlock的工作方式,或者是否有办法使滚动顺畅。  FWIW,这个确切的XAML在WPF应用中同样慢(减去主题画笔)。

Switching to a TextBox makes it faster.  I would like to know if that is just how TextBlock works or if there is a way to make the scrolling smooth.  FWIW, this exact XAML is just as slow in a WPF app (minus the theme brush).

KeepMyIdentities,密码安全的关键。现已在Windows应用商店中提供:http://apps.microsoft.com/webpdp/en-US/app/keepmyidentities/61a9f340-97ac-4666-beab-39f9246cb6fa

KeepMyIdentities, Your Key to Password Security. Available now on the Windows Store: http://apps.microsoft.com/webpdp/en-US/app/keepmyidentities/61a9f340-97ac-4666-beab-39f9246cb6fa

推荐答案

如果一个文本框速度更快,为什么不使用带有isEnable = false的文本框,然后更改文本块之类的样式。

If one textbox is more fast, why you don´t use a textbox with isEnable = false and then change the style for something like a textblock.


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

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