ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / StyleHelper Class / CreateStyle Method
The current ArcGIS Pro project to which the new style will be added.
The full path on disk of the new style file to be created.
Example

In This Topic
    CreateStyle Method
    In This Topic
    Creates a new style file (.stylx) on disk and adds the style to the current project. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Shared Sub CreateStyle( _
       ByVal project As Project, _
       ByVal styleName As String _
    ) 
    public static void CreateStyle( 
       Project project,
       string styleName
    )

    Parameters

    project
    The current ArcGIS Pro project to which the new style will be added.
    styleName
    The full path on disk of the new style file to be created.
    Exceptions
    ExceptionDescription
    This method must be called within the lambda passed to QueuedTask.Run
    Example
    How to create a new style
    {
        //Full path for the new style file (.stylx) to be created
        string styleToCreate = @"C:\Temp\NewStyle.stylx";
        //Note: Needs QueuedTask to run
        StyleHelper.CreateStyle(Project.Current, styleToCreate);
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also