How to use AvalonEdit in Microsoft Surface applica

2019-08-10 12:30发布

问题:

I'm using AvalonEdit in a Microsoft Surface application. It's working great, but I have one problem with folding. There are this small + icons to enable folding. But I don't know how I can register the appropriate contact handlers. Any hints how to do that?

回答1:

I'm not sure what you mean by "contact handlers".

But you have to supply a folding strategy class based on AbstractFoldingStrategy. However folding strategy to go with most commonly used braces is not in the default AvalonEditor package, you can find one in the sample application or find it somewhere on the internet. But as you can't really do it to 100% without syntactic analysis of the code being edited, this simple BraceFoldingStrategy will occasionally behave in a rather odd way.