If you're talking about a WPF designer, use the Context Type property / type
Details: - During development, you have an instance of modelItem (suppose you know this), if not, then you can create an instance of it in the Override implementation of the Activate method
// in class DesignAdorner
public class DesignAdorner : PrimarySelectionAdornerProvider { protected override void Activate(ModelItem item) { modelItem = item; } }
Now you can access the current application path using the following code with one line
string aplicationPathDir = System.IO.Directory.GetParent(modelItem.Context.ToString()).FullName;
Let me know if this does not help you.
source share