S
Sergey
I need a help to avoid WPF RichTextBox bug. I develop an application using
NET Framework 3.5 SP 1. My application contains RichTextBox and provides
Print Preview feature. I found that RichTextBox.GetPositionFromPoint()
method
raises an exception after RichTextBox.Document.DocumentPaginator call, and
RichTextBox stops working. The exception is raised inside
MS.Internal.Documents.DocumentPageTextView.Validate() method. The problem
easy reproduces by the following code (it also occurs in test project
containing RichTextBox only):
IDocumentPaginatorSource paginatorSource =
(IDocumentPaginatorSource)theRichTextBox.Document;
DocumentPaginator paginator = paginatorSource.DocumentPaginator;
theRichTextBox.GetPositionFromPoint(new Point(1, 1), true);
I've tried to make a copy of the document using TextRange.Save(stream,
DataFormats.Xaml) and TextRange.Load(stream, DataFormats.Xaml) and ask the
paginator from the copy. In this case the exception does not occurs, but all
images contained in the document are lost.
Can someone help me to avoid this problem, please?
Sincerely,
Sergey Zyryanov
NET Framework 3.5 SP 1. My application contains RichTextBox and provides
Print Preview feature. I found that RichTextBox.GetPositionFromPoint()
method
raises an exception after RichTextBox.Document.DocumentPaginator call, and
RichTextBox stops working. The exception is raised inside
MS.Internal.Documents.DocumentPageTextView.Validate() method. The problem
easy reproduces by the following code (it also occurs in test project
containing RichTextBox only):
IDocumentPaginatorSource paginatorSource =
(IDocumentPaginatorSource)theRichTextBox.Document;
DocumentPaginator paginator = paginatorSource.DocumentPaginator;
theRichTextBox.GetPositionFromPoint(new Point(1, 1), true);
I've tried to make a copy of the document using TextRange.Save(stream,
DataFormats.Xaml) and TextRange.Load(stream, DataFormats.Xaml) and ask the
paginator from the copy. In this case the exception does not occurs, but all
images contained in the document are lost.
Can someone help me to avoid this problem, please?
Sincerely,
Sergey Zyryanov