ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Core Namespace / ApplicationOptions Class
Members Example

In This Topic
    ApplicationOptions Class
    In This Topic
    Available Pro application backstage options.
    Object Model
    ApplicationOptions ClassDisplayOptions ClassDownloadOptions ClassEditingOptions ClassExploratoryAnalysisOptions ClassGeneralOptions ClassGeoprocessingOptions ClassLayoutOptions ClassMappingOptions ClassNavigationOptions ClassRasterImageryOptions ClassReportOptions ClassSelectionOptions ClassTableOptions ClassTextAndGraphicsElementsOptions ClassVersioningOptions Class
    Syntax
    public static class ApplicationOptions 
    Public MustInherit NotInheritable Class ApplicationOptions 
    Example
    Get LayoutOptions
    var lastToolActive = ApplicationOptions.LayoutOptions.KeepLastToolActive;
    var warnOnSurrounds = ApplicationOptions.LayoutOptions.WarnAboutAssociatedSurrounds;
    //eg <Install_Path>\Resources\LayoutTemplates\en-US
    var gallery_path = ApplicationOptions.LayoutOptions.LayoutTemplatePath;
    var defaultGuideColor = ApplicationOptions.LayoutOptions.DefaultGuideColor;
    QueuedTask.Run(() =>
    {
      var guideColor = ApplicationOptions.LayoutOptions.GetGuideColor();
    });
    Set LayoutOptions
    //keep graphic element insert tool active
    ApplicationOptions.LayoutOptions.KeepLastToolActive = true;
    //no warning when deleting a map frame results in other elements being deleted
    ApplicationOptions.LayoutOptions.WarnAboutAssociatedSurrounds = false;
    //path to .pagx files used as templates
    ApplicationOptions.LayoutOptions.LayoutTemplatePath = @"D:\data\layout_templates";
    
    QueuedTask.Run(() =>
    {
      var guideColor = ApplicationOptions.LayoutOptions.GetGuideColor();
      // set guide color
      ApplicationOptions.LayoutOptions.SetGuideColor(ColorFactory.Instance.RedRGB);
    });
    Get All Available Fonts
    //Note: see also SymbolFactory.Instance.GetAvailableFonts() which returns the
    //same list. Use for TextAndGraphicsElementsOptions.GetAvailableFonts() convenience
    
    QueuedTask.Run(() =>
    {
      //A list of tuples of Font name + associated Font Styles, one tuple per
      //font, is returned
      var fonts = ApplicationOptions.TextAndGraphicsElementsOptions.GetAvailableFonts();
      StringBuilder sb = new StringBuilder();
      sb.AppendLine("Pro Fonts\r\n============================");
      foreach (var font in fonts)
      {
        var styles = string.Join(",", font.fontStyles);
        sb.AppendLine($"{font.fontName}, [{styles}]");
      }
      System.Diagnostics.Debug.WriteLine(sb.ToString());
    });
    
    Get TextAndGraphicsElementsOptions
    QueuedTask.Run(() =>
    {
      //Get the default font (see also 'SymbolFactory.Instance.DefaultFont')
      var def_font = ApplicationOptions.TextAndGraphicsElementsOptions.GetDefaultFont();
      System.Diagnostics.Debug.WriteLine(
        $"\r\ndefault font: {def_font.fontName}, {def_font.styleName}");
    
      //Get the default graphics element symbols - point, line, poly, text
      var ptSymbol = ApplicationOptions.TextAndGraphicsElementsOptions.GetDefaultPointSymbol();
      var lineSymbol = ApplicationOptions.TextAndGraphicsElementsOptions.GetDefaultLineSymbol();
      var polySymbol = ApplicationOptions.TextAndGraphicsElementsOptions.GetDefaultPolygonSymbol();
      var textSymbol = ApplicationOptions.TextAndGraphicsElementsOptions.GetDefaultTextSymbol();
    });
    
    Set TextAndGraphicsElementsOptions
    QueuedTask.Run(() =>
    {
      //Set a default font. Use its default style
      ApplicationOptions.TextAndGraphicsElementsOptions.SetDefaultFont("tahoma");
      //or specify an explicit style
      ApplicationOptions.TextAndGraphicsElementsOptions.SetDefaultFont("tahoma", "bold");
    
      //Create symbols
      var ptSymbol2 = SymbolFactory.Instance.ConstructPointSymbol(
        ColorFactory.Instance.RedRGB, 14, SimpleMarkerStyle.Diamond);
      var lineSymbol2 = SymbolFactory.Instance.ConstructLineSymbol(
        ColorFactory.Instance.RedRGB, 2, SimpleLineStyle.Dash);
      var polySymbol2 = SymbolFactory.Instance.ConstructPolygonSymbol(
        ColorFactory.Instance.RedRGB, SimpleFillStyle.DiagonalCross);
      var textSymbol2 = SymbolFactory.Instance.ConstructTextSymbol(
        ColorFactory.Instance.RedRGB, 12);
    
      //Set default point, line, poly, text graphics element symbols
      ApplicationOptions.TextAndGraphicsElementsOptions.SetDefaultPointSymbol(ptSymbol2);
      ApplicationOptions.TextAndGraphicsElementsOptions.SetDefaultLineSymbol(lineSymbol2);
      ApplicationOptions.TextAndGraphicsElementsOptions.SetDefaultPolygonSymbol(polySymbol2);
      ApplicationOptions.TextAndGraphicsElementsOptions.SetDefaultTextSymbol(textSymbol2);
    });
    
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Core.ApplicationOptions

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also