WPF中Textbox TextWrapping="NoWrap" 当输入数据很长(超过9600)时会出现换行
1个回答
2015-03-05 · 知道合伙人数码行家
关注
展开全部
9600的限制是为了不占用所有的CPU时间。
由 Microsoft 在 2012/4/11 於 16:03 公布
Text is displayed by one of two internal classes: SimpleTextLine and FullTextLine. The former is faster but less general - it's used for most text unless special formatting features are required.
The 9600-character limit exists to defend against very long lines taking all the CPU time. In 4.0 it applied only to FullTextLine; in 4.5 it applies to both classes. You can see the same effect in 4.0 by doing anything that causes the text to use FullTextLine - for example, set FlowDirection="RightToLeft".
We need to keep the limit in effect for SimpleTextLine - the reasons we did that trump any compatibility concerns. Your behavior is a consequence. (You could argue that TextBlock/Box should only draw the first line when TextWrapping=NoWrap and the line is split because of the limit, but that would be a more significant behavior change that we won't address in 4.5.)
- WPF team
参见:https://connect.microsoft.com/VisualStudio/feedback/details/735541/wpf-textbox-and-textblock-will-show-text-wrap-when-text-is-more-than-9600
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询