The height of the SyntaxEditor does not seem to be automatically calculated in the RichTextBox's Blo

SyntaxEditor for WPF Forum

The latest build of this product (v25.1.0) was released 18 days ago, which was before this thread was created.
Posted 12 days ago by david lin
Version: 24.1.0
Avatar

Hello, developers of Actipro.

I am using the SyntaxEditor embedded in a FlowDocument, and it seems that the height of the SyntaxEditor does not automatically adjust based on the height of the code, which has caused us some trouble.

Perhaps I can dynamically calculate the required height of the SyntaxEditor through TextChanged.

But I would like to know if you will address this issue. 

Demo: 

https://github.com/lyq-lin/ActiproDemo

You can open SyntaxEditorDemo to learn more.

Comments (7)

Answer - Posted 11 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

SyntaxEditor doesn't auto-size by default since it adds a lot of additional processing.  This documentation topic talks about an option that does enable it.


Actipro Software Support

Posted 11 days ago by david lin
Avatar

Great, it works.

But there is one more question, how do we remove the extra whitespace below?

Posted 11 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

I'm glad that works, but I'm not sure what extra whitespace you are referring to.  If I set the SyntaxEditor.IsViewLineMeasureEnabled property to true and update your document text to only be a few lines long, I don't see any extra whitespace within the editor.

If you are referring to extra whitespace around the editor and within the FlowDocument, that may be added due to the BlockUIContainer.  You'd have to consult Microsoft documentation on anything related to that.


Actipro Software Support

Posted 6 days ago by david lin
Avatar

Hello, I'm sorry that I took a few days to continue this issue.

Regarding the extra whitespace issue, you can reproduce it with the following example.

I put two controls, SyntaxEditor and TextBox, into BlockUIContainer to detect their changes.

SyntaxEditor:

https://github.com/lyq-lin/ActiproDemo/blob/main/SyntaxEditorDemo/Image/blank.png

TextBox:

https://github.com/lyq-lin/ActiproDemo/blob/main/SyntaxEditorDemo/Image/textbox.png

From the above examples we can see that they have different manifestations.

Perhaps their different implementation principles lead to this difference, but this brings a little inconvenience to our flexible use of SyntaxEditor.

In addition, I also removed the FlowDocument to verify, the result is also obvious, am I missing something?

demo:

https://github.com/lyq-lin/ActiproDemo/tree/main/SyntaxEditorDemo

So do you have any ideas or suggestions? I just want SyntaxEditor to not have extra empty lines.

Posted 6 days ago by david lin
Avatar

I corrected my wording, I didn't mean extra blank lines, I meant extra spaces.

Posted 5 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Thank you for the screenshots.  It looks like you are referring to the SyntaxEditor.CanScrollPastDocumentEnd property, which is true by default.  You'd want to set that to false to make it so you can't scroll the last line up to the top of the view.  Does that help?


Actipro Software Support

Posted 4 days ago by david lin
Avatar

It seems I know why this situation has occurred.

When setting SyntaxEditor.CanScrollPastDocumentEnd=False in FlowDocument, it does not trigger scrolling, and it appears to be captured.

It seems I have encountered other troubles.

However, your suggestions are effective, and I thank you for your patient replies.

Add Comment

Please log in to a validated account to post comments.