Export (0) Print
Expand All

DialogPage Class

Provides a standard dialog functionality for implementing Toolbox property sheets, ToolsOptions pages, or custom UI dialog boxes with support for the Visual Studio automation model, Windows Forms, and state persistence through the Visual Studio settings mechanism.

This class is not CLS-compliant.  

Namespace: Microsoft.VisualStudio.Shell
Assembly: Microsoft.VisualStudio.Shell (in microsoft.visualstudio.shell.dll)

[CLSCompliantAttribute(false)] 
[ComVisibleAttribute(true)] 
public class DialogPage : Component, IWin32Window, IProfileManager
/** @attribute CLSCompliantAttribute(false) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class DialogPage extends Component implements IWin32Window, IProfileManager
CLSCompliantAttribute(false) 
ComVisibleAttribute(true) 
public class DialogPage extends Component implements IWin32Window, IProfileManager

Notes for Implementers

Implement classes derived from DialogPage when creating a user dialog box, particularly either a Tools Options page or a Toolbox property page.

Notes for Callers

The simplest implementation of DialogPage requires only the definition of public properties on the implementing class. The property types must support conversion to and from strings through TypeConverter.

The base implementation of DialogPage provides default handlers for standard windows events, and implements the Component, IWin32Window, and IProfileManager.

Classes derived from DialogPage have:

  1. Automatic support for component sharing through the Visual Studio DTE automation object model.

    • Any instance of DialogPage is an automation object, as the class inherits the Component interface's implementation.

    • Applications needing to access the class's automation object use the AutomationObject property.

      The AutomationObject property returns this (Me in Visual Basic), since the implementation of DialogPage is already an automation object by default.

    • An implementation of DialogPage can offer an automation object other then itself by overriding the base AutomationObject implementation.. This might be done, for example, to provide separate user interface and the object models.

  2. Support for the Visual Studio settings mechanism based on the public properties of the derived classes automation object.

    • For an object derived from DialogPage to provide persistence, it must be registered using ProvideProfileAttribute.

    • Types derived from DialogPage inherit a default persistence implementation of IProfileManager.

    • The default implementation persists all public properties of the derived class's automation object, the object returned by AutomationObject, that supports conversion to and from strings through TypeConverter.

    • This behavior can be changed by overriding LoadSettingsFromXml, SaveSettingsToXml, LoadSettingsFromStorage, and SaveSettingsToStorage.

  3. A default user interface based on the public properties of the derived class's automation object.

    • For a dialog page implementation to provide a Tools Options page it must be registered using ProvideOptionPageAttribute.

    • For a dialog page implementation to provide a Toolbox dialog page it must be registered using ProvideToolboxPageAttribute.

    • Dialog pages use Window to return a IWin32Window which provides a handle to the window providing the class's user interface.

    • By default the window referenced by Window is a property grid, implemented by an instance of PropertyGrid selecting the automation object.

    • The DialogPage base class uses its implementation of AutomationObject to obtain the class's automation object and the public properties of that automation object.

    • Changes to public properties made through a dialog page's user interface are automatically saved to local storage (typically the registry) by a call to the SaveSettingsToStorage method.

    • A dialog page implementation can change its user interface by overriding Window.

NoteNote

Typically an instance of a dialog page class is its own automation object. Therefore, properties persisted or displayed are those of the class derived from DialogPage. However, if AutomationObject returns another object, it is that object's properties, not the class's, which are persisted or displayed.

System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
      Microsoft.VisualStudio.Shell.DialogPage

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2015 Microsoft