This document is archived and information here might be outdated.  Recommended version.


Open StyleReferencesDialog Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Open StyleReferencesDialog Snippet

Opens the SytleReferencesDialog.

[C#]
///<summary>Opens the SytleReferencesDialog.</summary>
///<param name="application">An IApplication interface.</param>
///<remarks></remarks>
public void OpenStyleReferencesDialog(ESRI.ArcGIS.Framework.IApplication application)
{
  //parameter check
  if (application == null)
  {
    return;
  }

  ESRI.ArcGIS.ArcMapUI.IMxDocument mxDocument=(ESRI.ArcGIS.ArcMapUI.IMxDocument)application.Document; // Explicit Cast 
  ESRI.ArcGIS.Display.IStyleGallery styleGallery=mxDocument.StyleGallery;
  ESRI.ArcGIS.DisplayUI.IStyleDialog styleReferencesDialog=new ESRI.ArcGIS.DisplayUI.StyleReferencesDialogClass();
  styleReferencesDialog.DoModal(styleGallery, application.hWnd);
}
[Visual Basic .NET]
'''<summary>Opens the SytleReferencesDialog.</summary>
'''<param name="application">An IApplication interface.</param>
'''<remarks></remarks>
Public Sub OpenStyleReferencesDialog(ByVal application As ESRI.ArcGIS.Framework.IApplication)

  'parameter check
  If application Is Nothing Then

    Return

  End If

  Dim mxDocument As ESRI.ArcGIS.ArcMapUI.IMxDocument=CType(application.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument) ' Explicit Cast
  Dim styleGallery As ESRI.ArcGIS.Display.IStyleGallery=mxDocument.StyleGallery
  Dim styleReferencesDialog As ESRI.ArcGIS.DisplayUI.IStyleDialog=New ESRI.ArcGIS.DisplayUI.StyleReferencesDialogClass()
  styleReferencesDialog.DoModal(styleGallery, application.hWnd)

End Sub

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.ArcMapUI
  • ESRI.ArcGIS.Display
  • ESRI.ArcGIS.DisplayUI