文字更新减慢应用 [英] Text update slowing down app

查看:121
本文介绍了文字更新减慢应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个希伯来日历应用程序,其中每一天都是一个用户控件。我必须在控制的英语日期,希伯来日,犹太假日和其他一些用户定义的数据6标签。滚动时,标签的内容变化的用户控件的日期值上升或下降一个星期。滚动明显比Microsoft Outlook日历慢,分析表明,服用时间最长的部分是更新标签的内容,这是不是我的代码来处理。

I have a Hebrew calendar app where each day is a UserControl. I have 6 labels in that control for the English date, the Hebrew date, Jewish holidays and some other user-defined data. When scrolling, the labels' content changes as the date value for the UserControl goes up or down a week. The scrolling is noticeably slower than Microsoft Outlook Calendar, and profiling reveals that the part taking the longest is updating the label contents, which is not handled by my code.

有一些办法可以让这个走得更快? MS Outlook中似乎有文本字段的可比数量,以及滚动是光滑的。

Is there some way I can make this go faster? MS Outlook seems to have a comparable number of text fields, and the scrolling is smooth.

推荐答案

的TextBlocks 并不明显快于标签,但字形给我的日历挥鞭。

TextBlocks were not noticeably faster than Labels, but Glyphs gave my calendar whiplash.

更换此

<TextBlock Padding="5"
           FontFamily="Narkisim"
           FontWeight="Bold"
           FontSize="20"
           Text="{Binding HebrewDate}"/>



with this

<Glyphs Name="HebrewDate"
        Margin="5"
        StyleSimulations="BoldSimulation"
        FontUri = "/Fonts/nrkis.ttf"
        FontRenderingEmSize = "20"
        UnicodeString = "5771 ןושח ה"
        Fill = "Black"/>



做滚动超级快。

made scrolling super fast.

一些注意事项:


  1. 字形不支持绑定,所以只好给每一个名称和代码更新他们身后,就像这样:

  1. Glyphs do not support binding, so I had to give each one a name and update them in the code behind, like so:

HebrewDate.UnicodeString = zman.HebrewDate;


  • 字形没有布局功能,使希伯来文是倒退出来。我不得不预处理希伯来串用的倒车功能。即使倒车后视,希伯来元音点就出来了错位,所以我保留了标签对于那些使用元音。

  • Glyphs don't have Layout functionality so Hebrew text was coming out backwards. I had to preprocess the Hebrew strings with a reversing function. Even after reversing, the Hebrew vowel points came out misaligned, so I retained Labels for those strings which use vowels.

    这篇关于文字更新减慢应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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