I created a custom editor for a WinForms component which implements UITypeEditor and works fine. The editor should load information from the currently opened solution and I think this should be done with DTE from the VisualStudio SDK.
According to a MSDN article (http://msdn.microsoft.com/en-us/library/ee834473(v=vs.110).aspx) I implemented this exactly like this:
internal class TreeViewTypeEditor : UITypeEditor
{
[Import]
internal SVsServiceProvider ServiceProvider = null;
protected override Control GetEditControl(ITypeDescriptorContext context, object value)
{
// ServiceProvider is NULL here!
DTE dte = (DTE)ServiceProvider.GetService(typeof(DTE));
}
}
ServiceProvider
will always be null but why? What am I doing wrong?