Search code examples
visual-studio-extensionsvsixvs-extensibilityvisual-studio-sdk

Visual Studio SDK - Handle mouse events for margins


Is there any way to override mouse events connected with the Visual Studio IDE margin? I looked at the IMouseProcessorProvider interface, but it seems to work only with mouse events connected with the code editor window. For example:

public override void PostprocessMouseLeftButtonDown(MouseButtonEventArgs e)
{
    MyMethod();
}

MyMethod gets called only when I click the left button somewhere in the code editor window. I would like it to be called after clicking on a margin. How can I implement that?


Solution

  • I managed to find a solution - I was interested in calling MyMethod after clicking on my custom glyph on the margin, so I fetched the UIElement object representing the glyph (from my glyph factory class) and then I was able to implement MouseLeftButtonDown event.