avalonedit

How to use AvalonEdit in Microsoft Surface application?

杀马特。学长 韩版系。学妹 提交于 2019-12-13 02:35:28
问题 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

Making (and keeping) lines readonly in AvalonEdit

≡放荡痞女 提交于 2019-12-13 02:23:03
问题 What is a robust way of making certain lines readonly in an AvalonEdit control? Users are allowed to change certain method bodies in a C# or VB template file but nothing else. The readonly state per line needs to be kept intact when users add or remove lines, i.e. the readonly blocks below the edited content need to shift up and down accordingly. I'm using AvalonEdit in a WPFHost on winforms. 回答1: You can set textEditor.TextArea.ReadOnlySectionProvider to an implementation of

AvalonEdit: is it possible to highlight this syntax?

不羁岁月 提交于 2019-12-11 06:38:49
问题 I have a simple "language" (similar to template languages and simple markup languages such as BBcode — basically it's just normal text with some variables, tags and similar features) and I want to highlight its syntax. Here is the thing I am stuck with. There are variables, they are enclosed with $ sign ( $var1$ ). I highlight them with this rule: <RuleSet name="VariableSet"> <Rule color="Variable"> \$\S+?\$ </Rule> </RuleSet> Some area around a variable can be surrounded with { } characters.

AvalonEdit: Copy takes forever for large highlighted text files

天涯浪子 提交于 2019-12-10 20:44:37
问题 Actually this was asked on http://community.sharpdevelop.net/forums/p/21949/56153.aspx#56153 but with no answer yet - so I try it here. I'm using Avalon Edit (ICSharpCode.AvalonEdit.dll 4.4.2) in a WPF 4.0 application. I have loaded a text file (~7 MBytes) into the editor. When I apply syntax highlighting and then coping (Control-A and Control-C) the whole text it takes forever (without highlighting it's done in a second) When I break into debugger I get the following callstack (shortened):

Changing default line height in avalon edit

不问归期 提交于 2019-12-10 18:19:03
问题 I am writing a custom software using avalon edit and I am looking for a way to make the space (height) between lines bigger. At the moment I am forced to add an empty line every time the user has ended writing a line and wants to write another. I have started looking into the TextView Class where defaultLineHeight seems to be calculated but the only thing I was able to affect is the height of the visual caret but not the content itself. At the moment I am looking at making every pair line

Highlight all occurrences of selected word in AvalonEdit

早过忘川 提交于 2019-12-10 04:13:21
问题 I need to highlight all occurrences of selected word in AvalonEdit. I created an instance of HihglinghtingRule class: var rule = new HighlightingRule() { Regex = regex, //some regex for finding occurences Color = new HighlightingColor {Background = new SimpleHighlightingBrush(Colors.Red)} }; What should I do after it ? Thanks. 回答1: To use that HighlightingRule , you would have to create another instance of the highlighting engine ( HighlightingColorizer etc.) It's easier and more efficient to

Uppercasing in AvalonEdit

好久不见. 提交于 2019-12-07 22:58:36
问题 I am writing a movie script editor using AvalonEdit. I extended the DocumentLine class to have a "Type" property, with the value representing either a "Character", "Dialog Line", etc. I would like document lines of a certain type within the script to be written in upper case (character names for example). Is there an extension point within the rendering pipeline that would allow me to fetch a document line and change it's casing ? I tried creating a class that extends

Weird scrollbar UI in hosted WPF composite control

ε祈祈猫儿з 提交于 2019-12-06 10:32:29
My windows forms application hosts AvalonEdit (the composite WPF control in question) in one of its forms to cater to its text editing requirements. Here's the code I use: WPFHost = gcnew ElementHost(); TextField = gcnew AvalonEdit::TextEditor(); WPFHost->Dock = DockStyle::Fill; WPFHost->Child = TextField; TextField->Options->AllowScrollBelowDocument = false; TextField->Options->EnableEmailHyperlinks = false; TextField->Options->EnableHyperlinks = true; TextField->Options->RequireControlModifierForHyperlinkClick = true; TextField->ShowLineNumbers = true; ContainerControl->Controls->Add(WPFHost

Uppercasing in AvalonEdit

一世执手 提交于 2019-12-06 06:27:12
I am writing a movie script editor using AvalonEdit. I extended the DocumentLine class to have a "Type" property, with the value representing either a "Character", "Dialog Line", etc. I would like document lines of a certain type within the script to be written in upper case (character names for example). Is there an extension point within the rendering pipeline that would allow me to fetch a document line and change it's casing ? I tried creating a class that extends DocumentColorizingTransformer, but changing the casing within the "protected override void ColorizeLine(DocumentLine line)"

Highlight all occurrences of selected word in AvalonEdit

梦想的初衷 提交于 2019-12-05 06:30:22
I need to highlight all occurrences of selected word in AvalonEdit. I created an instance of HihglinghtingRule class: var rule = new HighlightingRule() { Regex = regex, //some regex for finding occurences Color = new HighlightingColor {Background = new SimpleHighlightingBrush(Colors.Red)} }; What should I do after it ? Thanks. To use that HighlightingRule , you would have to create another instance of the highlighting engine ( HighlightingColorizer etc.) It's easier and more efficient to write a DocumentColorizingTransformer that highlights your word: public class ColorizeAvalonEdit :