ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / NorthArrowStyleItem Class
Members Example

In This Topic
    NorthArrowStyleItem Class
    In This Topic
    Represents a north arrow saved in a style.
    Object Model
    NorthArrowStyleItem ClassCIMNorthArrow Class
    Syntax
    Public Class NorthArrowStyleItem 
       Inherits StyleItem
       Implements System.ComponentModel.INotifyPropertyChanged 
    public class NorthArrowStyleItem : StyleItem, System.ComponentModel.INotifyPropertyChanged  
    Example
    Create North Arrow From StyleItem 1
    {
      //Create a north arrow using a style.
    
      //Search for a style project item by name
      StyleProjectItem arcgis2dStyles = Project.Current.GetItems<StyleProjectItem>()
                        .First(si => si.Name == "ArcGIS 2D");
    
      //Construct on the worker thread
    
      NorthArrowStyleItem naStyleItem = arcgis2dStyles.SearchNorthArrows(
                    "ArcGIS North 13").FirstOrDefault();
    
      //Reference the map frame and define the location
      MapFrame newFrame = layout.FindElement("New Map Frame") as MapFrame;
      Coordinate2D nArrow = new Coordinate2D(6, 2.5);
    
      //Construct the north arrow
    
      var naInfo = new NorthArrowInfo()
      {
        MapFrameName = newFrame.Name,
        NorthArrowStyleItem = naStyleItem
      };
      var newNorthArrow = ElementFactory.Instance.CreateMapSurroundElement(
                              layout, nArrow.ToMapPoint(), naInfo);
    }
    Create North Arrow From StyleItem 2
    {
      //Note: Must be on QueuedTask.Run
    
      //Build geometry
      Coordinate2D center = new Coordinate2D(7, 5.5);
    
      //Reference a North Arrow in a style
      StyleProjectItem stylePrjItm = Project.Current.GetItems<StyleProjectItem>()
                                     .FirstOrDefault(item => item.Name == "ArcGIS 2D");
      NorthArrowStyleItem naStyleItm = stylePrjItm.SearchNorthArrows(
                                             "ArcGIS North 10")[0];
    
      //Reference MF, create north arrow and add to layout 
    
      var mf = layout.FindElement("Map Frame") as MapFrame;
      var narrow_info = new NorthArrowInfo()
      {
        MapFrameName = mf.Name,
        NorthArrowStyleItem = naStyleItm
      };
      var arrowElm = (NorthArrow)ElementFactory.Instance.CreateMapSurroundElement(
        layout, center.ToMapPoint(), narrow_info) as NorthArrow;
      arrowElm.SetName("New North Arrow");
      arrowElm.SetHeight(1.75);
      arrowElm.SetX(7);
      arrowElm.SetY(6);
    }
    How to search for north arrows in a style
    {
        //Search for north arrows
        //Note: styleProjectItem was created above in the variable initialization section
        //Note: Needs QueuedTask to run
        styleProjectItem.SearchNorthArrows("searchString");
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
          ArcGIS.Desktop.Mapping.StyleItem
             ArcGIS.Desktop.Mapping.NorthArrowStyleItem

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also