I'm trying to create an adornment layer to display vertical columns (from a list).
I've adapted the drawing code in the ColorPreviewSyntaxLanguage sample to draw the lines from the adornment layer
var pt1 = new Point(adornment.Location.X, 0);
var pt2 = new Point(adornment.Location.X, context.TextAreaBounds.Bottom);
pt1.Offset(context.TextAreaBounds.Location);
pt2.Offset(context.TextAreaBounds.Location);
context.DrawLine(pt1, pt2, Pens.Red);
And created a ColumnTagger class based on TaggerBase<ColumnMarkerTag> which outputs a list of tags based on my list of columns. This all pretty much works, however, if I add an entry to the columns list its not re-drawn.
return ((ColumnMarkerSyntaxLanguage)this.Document.Language).Columns.Select(
c => new TagSnapshotRange<ColumnMarkerTag>(
new TextSnapshotRange(snapshotRanges[0].Snapshot, c, c + 1),
new ColumnMarkerTag() { ColumnIndex = c }));
where ColumnMarkerSyntaxLanguage has the property
public List<int> Columns { get; } = new List<int>();
I've tried invalidating the editor but it doesn't seem to cause the adorments to refresh. The only thing that causes a refresh is a change to the actual document. I think this is possibly as I'm attaching the tag to a text range that potentially does not exist (the document could be empty). How do I force an adornment refresh?
Note: this adornment layer was built into the older version of the syntax editor control, would it be possible to re-add it into the current version?