Disable automatic region collapse

SyntaxEditor for WPF Forum

Posted 6 years ago by horato
Version: 17.2.0665
Avatar

Hello,

I have SyntaxEditor with .net addon and around 700 lines of code with multiple #region blocks. When the editor is loaded and its content is parsed, it sometimes collapses all the regions on its own. How can I disable this behavior?

 

Thank you

Comments (5)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Any outlining node that is created with an IOutliningNodeDefinition.IsDefaultCollapsed set to true will collapse when the document is loaded.  Regions are usually set up that way.  The only way to prevent that is to use an IOutliningNodeDefinition that returns false for that IsDefaultCollapsed property. 

Which syntax language are you using?


Actipro Software Support

Posted 6 years ago by horato
Avatar

Hello,

C#.

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The only way you could prevent it from happening in our .NET Languages Add-on would be to use reflection on the CSharpOutliningSource class and look for static fields of type OutliningNodeDefinition.  One of them has a Key of "RegionPreprocessorDirective".  Set that object's IsDefaultCollapsed property to false.  You'd do this at your app startup.


Actipro Software Support

Posted 6 years ago by horato
Avatar

Thank you, it seems to be working. Is there any way to avoid the magic string?

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Unfortunately no... the OutliningNodeDefinition is passed that string key directly and it isn't really referenced anywhere else in our code.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.