Ability to add Visual Elements to Line

Is it possible to add additional visual elements to lines similar to the VisualLineElementGenerator in avalon edit?
http://avalonedit.net/documentation/html/c06e9832-9ef0-4d65-ac2e-11f7ce9c7774.htm
Hello,
We do have some ways of drawing some additional graphic primitives using CustomDraw event (this only available in WinForms edition).
If you could elaborate on what sort of additional elements you'd like to draw, and whether you use WinForms or WPF version, we might be able to come up with solution how to implement it.
regards,
Andrew
Essentially I just need to draw a button next to some readonly lines of code (namespace declarations) to allow them to be removed from a read only section of the editor.
Hello,
I've uploaded sample WinForms demo here:
http://www.alternetsoft.com/forum/CustomVisualElements.zip
Please try it and let me know whether it helps.
regards,
Andrew
Thanks for the sample but the project I am currently looking at this for is WPF.
Although I think I can use the namespace node line flagging from your example and just pick up delete or backspace key presses on the read only lines instead of having something graphical to click.
I'll give it a shot. Thanks for your help.
I'm getting close to a workable solution but I still have a couple issues. The Lines.RemoveAt does not seem to store and undo event and does not trigger the TextChanged event on the editor. Any way to get it to do both of these?
Hello,
Manipulating lines directly bypasses undo buffer. Instead you should use Selection.DeleteLine method like this:
int lineIndex = 11;
int oldPos = syntaxEdit1.Position.Y;
try
{
syntaxEdit1.Source.BeginUpdate();
syntaxEdit1.MoveToLine(lineIndex);
syntaxEdit1.Selection.DeleteLine();
}
finally
{
syntaxEdit1.MoveToLine(oldPos);
syntaxEdit1.Source.EndUpdate();
}
regards,
Andrew
This does not seem to be working for me. The editor is not updated nor is the underlying Roslyn document.
I've re-checked the cod and it indeed does not work in case you're deleting readonly line. Here's modified code:
int lineIndex = 11;
int oldPos = edit.Position.Y;
try
{
edit.Source.BeginUpdate();
edit.Source.SetLineReadonly(lineIndex, false);
edit.MoveToLine(lineIndex);
edit.Selection.DeleteLine();
}
finally
{
edit.MoveToLine(oldPos);
edit.Source.EndUpdate();
}
Please let me know if you need undo to restore line's readonly state as well.
On a different note, we've added event to draw custom graphics on a gutter in WPF version as well - I can send you updated dll and example of how to use it if needed.
Regards,
Andrew