ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / NorthArrowInfo Class / NorthArrowStyleItem Property
Example

In This Topic
    NorthArrowStyleItem Property
    In This Topic
    Gets and sets the north arrow style item: ArcGIS.Desktop.Mapping.NorthArrowStyleItem
    Syntax
    Public Property NorthArrowStyleItem As NorthArrowStyleItem
    public NorthArrowStyleItem NorthArrowStyleItem {get; set;}
    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);
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also