ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / StyleHelper Class / AddItem Method
The StyleProjectItem to which StyleItem will be added.
The StyleItem to be added.
Example

In This Topic
    AddItem Method (StyleHelper)
    In This Topic
    Adds a style item to a style. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Shared Sub AddItem( _
       ByVal styleProjectItem As StyleProjectItem, _
       ByVal item As StyleItem _
    ) 
    public static void AddItem( 
       StyleProjectItem styleProjectItem,
       StyleItem item
    )

    Parameters

    styleProjectItem
    The StyleProjectItem to which StyleItem will be added.
    item
    The StyleItem to be added.
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run
    Adding an item cannot be performed on a read-only style.
    The item could not be added to the style. The key may not be unique.
    Example
    How to add a style item to a style
    {
        //Create a new style item
        //You can generate a swatch for a text symbols also.  
        CIMSymbol symbolToAdd = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.GreenRGB, 1.0, SimpleMarkerStyle.Circle);
        SymbolStyleItem styleItemToAdd = new SymbolStyleItem()
        {
            Symbol = symbolToAdd,
            PatchHeight = 64,
            PatchWidth = 64
        };
        styleProjectItem.AddItem(styleItemToAdd);
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also