void UpdateIsSelected(AdornmentTagInfo adornmentInfo, ITextViewLine line) { if (line == null) { line = wpfTextView.TextViewLines.GetTextViewLineContainingBufferPosition(adornmentInfo.Span.Start); } var selSpan = line == null ? null : wpfTextView.Selection.GetSelectionOnTextViewLine(line); bool selected = selSpan != null && selSpan.Value.Contains(new VirtualSnapshotSpan(adornmentInfo.Span)); IntraTextAdornment.SetIsSelected(adornmentInfo.UserUIElement, selected); }
void UpdateIsSelected() { if (adornmentTagInfos.Count == 0) { return; } if (wpfTextView.Selection.IsEmpty) { foreach (var info in adornmentTagInfos) { IntraTextAdornment.SetIsSelected(info.UserUIElement, false); } } else { foreach (var info in adornmentTagInfos) { UpdateIsSelected(info, null); } } }