ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / StyleHelper Class / RemoveItem Method
The StyleProjectItem from which StyleItem will be removed.
The StyleItem to be removed.
Example

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

    Parameters

    styleProjectItem
    The StyleProjectItem from which StyleItem will be removed.
    item
    The StyleItem to be removed.
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run
    Removing an item cannot be performed on a read-only style.
    Example
    How to remove a style item from a style
    public Task RemoveStyleItemAsync(StyleProjectItem style, StyleItem itemToRemove)
    {
      return QueuedTask.Run(() =>
      {
        if (style == null || itemToRemove == null)
          throw new System.ArgumentNullException();
    
        //Remove the item from style
        style.RemoveItem(itemToRemove);
      });
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also