Showing caret when focus is lost

SyntaxEditor for WPF Forum

Posted 5 years ago by Alex
Version: 19.1.0681


I would like to be able to display the caret at all times in the SyntaxEditor, even when the SyntaxEditor focus is lost. However, I haven't found a property in the documentation about keeping the caret visible. I've seen some examples with setting FocusManager.IsFocusScope="True" on a a standard WPF TextBox but I don't think it can be applied to the SyntaxEditor. I tried it and the caret still disappear after losing focus.

If I want to achieve this, does my only solution is to create, in the same fashion as your AdornmentsIntraTextNotes example, an intra-space adorner that will show a caret look-alike (doesn't need to blink) and hook on SyntaxEditor LostFocus/GotFocus to make the adorner show/hide?

Thank you.

Comments (2)

Answer - Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Alex,

That is correct, since the editor tracks keyboard focus for when to show the caret, there is no property to force it to show when not focused.

And you are right, an adornment would be needed to simulate a faux caret when the real one isn’t active.

Actipro Software Support

Posted 5 years ago by Alex

Understood. Thank you very much for your fast answer!

The latest build of this product (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.