I am currently working on a plugin (I cannot give any more information about this yet I will post it on my blog shortly) using WPF. The main application that hosts all plugins uses the System.Addin (.Net 3.5 version). While developing the plugin I got into a brick wall… Basically I was calling the AdornerLayer.GetAdornerLayer, passing the instance of the plugin UI as parameter yet the method was returning a big and ugly null.
I started digging into the problem and had a look at how the Addin system works. Basically all addins are sandboxed into a seperate appdomain and there is no possible way how you can get the instance of the AdornerLayer of the main window (Or better there is no easy way of doing that) …
I solved this problem by creating an AdornerDecorator as an element in my XAML and then get the adorner layer of this AdornerDecorator. So the XAML would look something like this
….other XAML here
Then in C# i just call the myAdornerLayer.AdornerLayer and do what ever I want with it. This solution does not help if you want an adorner layer for all the main window that is hosting your plugin, the adorner layer will ONLY cover the surface area of the plugin. Yet if you do not need the whole area of the main window but only the surface area of the plugin, this solution should work just fine ….
Hope you find this useful…
Looking forward to post the plugin online….. I am sure you will love it😛