Bug with adornment example

SyntaxEditor for WPF Forum

Posted 5 years ago by gareth
Version: 19.1.0681
Platform: .NET 4.7
Environment: Windows 10 (64-bit)
Avatar

Hi, I think there's a bug with the SyntaxEditor's alternating rows example where it keeps adding adornments on text area layout. To repro, go to the sample browser -> "Adornments 5 - Alternating Rows" and scroll up and down with the mouse wheel. 

Would clearing all adornments first in the OnViewTextAreaLayout method be an acceptable solution? e.g this.AdornmentLayer.RemoveAllAdornments(AdornmentChangeReason.Other);

Comments (1)

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

Hi Gareth,

Thanks for letting us know.  This bug was caused due to some adornments API changes for 2019.1, and the sample wasn't updated to handle them.

Basically adornments now track a view line if they are for a decoration and an AdornmentLayer.FindAdornments overload was added with a view line parameter to help locate those.  However this particular sample was using a view line as a "tag" instead, so the FindAdornments overload for "object tag" was never getting invoked since it was using the other view line-based overload. 

We've fixed the sample for the next maintenance release, but in the meantime if you look in AlternatingRowsAdornmentManager, update each FindAdornments call by casting the "viewLine" argument to an "object", it will pick up the correct tag-based overload.

In our slightly more extensive fix, we have made another utility method in that sample that we use for each place we want to call FindAdornments that effectively does the same object cast:

private IAdornment[] GetAdornmentsWithTag(object tag) {
	return this.AdornmentLayer.FindAdornments(tag);
}


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.