ArcGIS Pro 3.8 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / StyleItem Class / PatchWidth Property
Example

In This Topic
    PatchWidth Property (StyleItem)
    In This Topic
    Gets or sets the width of preview image for the style item.
    Syntax
    public int PatchWidth {get; set;}
    Public Property PatchWidth As Integer
    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);
    }
    Create a Swatch for a given symbol
    {
      await QueuedTask.Run(() =>
      {
        CIMSymbol symbolForSwatch = SymbolFactory.Instance.ConstructPointSymbol(ColorFactory.Instance.GreenRGB, 1.0, SimpleMarkerStyle.Circle);
        //You can generate a swatch for a text symbols also.
        var si = new SymbolStyleItem()
        {
          Symbol = symbolForSwatch,
          PatchHeight = 64,
          PatchWidth = 64
        };
      });
    }
    Requirements

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

    ArcGIS Pro version: 3.0 or higher.
    See Also