0

I'm using avalondock 2.0 dll in my solution and I need to change IOverlayWindowHost.GetDropAreas method from DockingManager.cs at another project. But, I don't want to do this at the source file. The method is not virtual and I can't just override it like this

class CustomDockingManager : DockingManager
{
     override IEnumerable<IDropArea> GetDropAreas(LayoutFloatingWindowControl draggingWindow)
     {
          //some changes
     }
}
Artem Kyba
  • 855
  • 1
  • 11
  • 30

2 Answers2

2

Although not recommended in general, you can use the C# ability to reimplement explicitly just a single method of an interface, like this

class CustomDockingManager : DockingManager, IOverlayWindowHost
{
    IEnumerable<IDropArea> IOverlayWindowHost.GetDropAreas(LayoutFloatingWindowControl draggingWindow)
    {
        // ...
    }
}

Note that this way you cannot use the base implementation, you have to write the method from scratch.

Ivan Stoev
  • 195,425
  • 15
  • 312
  • 343
1

You would need to do IL weaving to change a non-virtual method. You've many options here.

Community
  • 1
  • 1
Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206