简体   繁体   English

在Universal Windows Apps中将文本追加到TextBox元素的最佳方法是什么

[英]What is the best method to append text to TextBox element in Universal Windows Apps

In my Universal Windows App i want to log some events and writing them in a TextBox Element. 在我的通用Windows应用程序中,我想记录一些事件并将其写入TextBox元素中。 But i couldn't find a method like named "appendText". 但我找不到名为“ appendText”的方法。 And below method makes flickering on screen 并且下面的方法使屏幕闪烁

txtbox.Text += log;

What is the best method to appendText for TextBox or TextBlock or RichTextEdit elements? 为TextBox或TextBlock或RichTextEdit元素添加appendText的最佳方法是什么?

if you want to display some logging information, it might be read only information so using a TextBlock is already an optimization. 如果要显示一些日志记录信息,则它可能是只读信息,因此使用TextBlock已经是一种优化。 Then, depending on your needs, a multi-item control such as a ListBox, ListView or GridView might be even better for logs. 然后,根据您的需求,对于日志而言,诸如ListBox,ListView或GridView之类的多项目控件可能更好。 If you have more than hundreds of lines, think about using virtualization. 如果您有数百行,请考虑使用虚拟化。

https://msdn.microsoft.com/en-us/library/windows/apps/mt574120.aspx https://msdn.microsoft.com/en-us/library/windows/apps/mt574120.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM