[英]Text Wrap not working with WPF RichtextBox
I have a WPF User Control with a RichTextBox in it. 我有一个带有RichTextBox的WPF用户控件。 I am consuming this User Control in one the WPF pages.
我在一个WPF页面中使用了此用户控件。 Alongwith it, I am using a FlowDocumentPageViewer with a ListView in it.
与此同时,我正在使用带有ListView的FlowDocumentPageViewer。 Later on, I am assigning the data of ListView in the RichTextBox using a FlowDocument.
稍后,我将使用FlowDocument在RichTextBox中分配ListView的数据。 Everything goes well but the wrap functionality does not work in it.
一切正常,但是自动换行功能无法使用。
On behalf of @Sumit (who asked the question) 代表@Sumit(问了这个问题)
below is the code snippet which is currently being used. 以下是当前正在使用的代码段。
1) User Control with RichTextBox 1)使用RichTextBox进行用户控制
2) Method to bind FlowDocument to RichTextBox 2)将FlowDocument绑定到RichTextBox的方法
3)Consumer Page 3)消费页面
4) Consumer Page Code behind 4)消费者页面代码后面
To diagnose the problem for wrap functionality, I segregated the components being used in the current XAML code into different solutions. 为了诊断包装功能的问题,我将当前XAML代码中使用的组件隔离到不同的解决方案中。
Please refer the following description to understand the steps followed in the analysis:- 请参考以下说明以了解分析中遵循的步骤:-
After isolating the components in this way, I observed that while integrating the User Control with FlowDocumentPageViewer the wrap functionality stopped working. 以这种方式隔离了组件之后,我观察到在将用户控件与FlowDocumentPageViewer集成时,自动换行功能停止工作。
This was resolved when I put Style with property Text Wrapping set to Wrap for the FlowDocument itself. 这时候我把风格与属性文字环绕设置为包裹的FlowDocument的本身得到解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.