3

I am writing a Visual Studio extension that hovers above everything inside the text editor (above selections, text, etc).

[Export(typeof(IWpfTextViewCreationListener))]
[ContentType("csharp")]
[TextViewRole(PredefinedTextViewRoles.Interactive)]
internal sealed class MyAdornmentFactory : MyAdornmentFactoryBase, IWpfTextViewCreationListener
{
    [Export(typeof(AdornmentLayerDefinition))]
    [Name("MyName")]
    [Order(After = PredefinedAdornmentLayers.Text, Before = PredefinedAdornmentLayers.Caret)]
    [TextViewRole(PredefinedTextViewRoles.Interactive)]
    public AdornmentLayerDefinition EditorAdornmentLayer;
    // ...
}

Problem is, that my WPF UserControl always "hides" behind the text - no matter how I play with the OrderAttribute.

Am i doing something wrong? is there something else that can influence this behavior?

EDIT: I can now confirm that it ~sometimes~ work, possibly with connection to running without debugging... does anybody know of a related visual studio bug?

seldary
  • 6,186
  • 4
  • 40
  • 55

1 Answers1

0

It should Work, or better for me is working setting order in your exaclty way. eg if you start from the template for Highlight 'A' in every line called TextAdornment (comes with vs2010 SDK) and change the zorder from

[Order(After=PredefinedAdornmentLayers.Selection, Before=PredefinedAdornmentLayers.Text)]

to

[Order(After=PredefinedAdornmentLayers.Text, Before=PredefinedAdornmentLayers.Caret)]

the adornments will be placed over the editor Text. hope it hepls.

ilmax
  • 111
  • 1
  • 4
  • 2
    As mentioned in my edit, i know it should work, and i have already seen it working - problem is that sometimes it doesn't, without me changing anything in these lines. I am hoping to find some other "thing" (code, configuration, bug, whatever) that might change this behavior. – seldary Oct 08 '11 at 19:08