I am implementing a custom language service for Visual Studio; the project node shall provide some configuration independent property pages (like Application-, Debug-, Build Events, ...) which are displayed in a tabbed view. The registration of property pages works somehow, but they show up in a non-modal dialog, which is not the wanted behavior...
This is what I´ve done...
I´ve a created the PropertyPageBase
class that implements the IPropertyPage
interface (I can provide further details of that implementation, if necessary)...
[ComVisible(true)]
public abstract class PropertyPageBase : IPropertyPage
{
private Control control;
protected abstract Control CreateControl();
public Control Control
{
get { return this.control ?? (this.control = this.CreateControl()); }
}
...
}
Custom property pages are derived from that base class; for instance...
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDual)]
[Guid(...)]
public sealed class GeneralPropertyPage : PropertyPageBase
{
protected override Control CreateControl()
{
return new GeneralPropertyPageControl(this);
}
}
I use MPF
(Managed Package Framework for Projects) to implement node types for the project hierarchy. So, there´s the ProjectNodeBase
class (which is derived from MPF ProjectNode
) where I´ve overriden the GetConfigurationIndependentPropertyPages
method; this implementation obtains property pages from attached attributes; so I don´t have to override that method again in my concrete implementation...
public abstract class ProjectNodeBase : ProjectNode
{
protected override Guid[] GetConfigurationIndependentPropertyPages()
{
Type thisType = this.GetType();
IEnumerable<Type> pageTypes = thisType.GetCustomAttributes(typeof(ProvideProjectPropertyPageAttribute), true)
.Cast<ProvideProjectPropertyPageAttribute>()
.Select(x => x.PropertyPageType);
return pageTypes.Select(x => x.GUID)
.ToArray();
}
}
At my concrete project node class, I just declare project property pages like that...
[ProvideProjectPropertyPageAttribute(PropertyPageType = typeof(GeneralPropertyPage))]
public sealed class CustomProjectNode : ProjectNodeBase
{
...
}
As I wrote, the property page gets shown when I click the Properties-command within the project´s context menu (in Solution Explorer), but instead of the tabbed view a non-modal dialog appears. So, the question is, how I can tweak it to the wanted behavior?