ArcGIS Pro 2.7 API Reference Guide
GetPatchMaterialIndex Method
Example 

ArcGIS.Core.Geometry Namespace > Multipatch Class : GetPatchMaterialIndex Method
The index of the patch. Must be greater than or equal to zero and less than PartCount.
Gets the index of the material for the specified patch (part).
Syntax
public int GetPatchMaterialIndex( 
   int patchIndex
)
Public Function GetPatchMaterialIndex( _
   ByVal patchIndex As Integer _
) As Integer

Parameters

patchIndex
The index of the patch. Must be greater than or equal to zero and less than PartCount.

Return Value

The index into the materials array of the multipatch for the patch.
Exceptions
ExceptionDescription
The patch index must be >= 0.
The patch index must be less than the number of patches (parts) in the multipatch.
This multipatch does not have materials.
Remarks
The material index is used in several methods to get properties of the material. If the patch has material, the returned value is greater than or equal to zero and less than MaterialCount. If the patch does not have material, -1 is returned.
Example
/// <summary>
/// This method gets several properties of a material in a multipatch.
/// This method must be called on the MCT. Use QueuedTask.Run.
/// </summary>
/// <param name="multipatch">The input multipatch.</param>
/// <param name="patchIndex">The index of the patch (part) from which to get the material properties.</param>
public void GetMaterialProperties(Multipatch multipatch, int patchIndex)
{
  if (multipatch.HasMaterials)
  {
    // Get the material index for the specified patch.
    int materialIndex = multipatch.GetPatchMaterialIndex(patchIndex);

    System.Windows.Media.Color color = multipatch.GetMaterialColor(materialIndex);
    int tranparencyPercent = multipatch.GetMaterialTransparencyPercent(materialIndex);
    bool isBackCulled = multipatch.IsMaterialCullBackface(materialIndex);

    if (multipatch.IsMaterialTextured(materialIndex))
    {
      int bpp = multipatch.GetMaterialTextureBytesPerPixel(materialIndex);
      int columnCount = multipatch.GetMaterialTextureColumnCount(materialIndex);
      int rowCount = multipatch.GetMaterialTextureRowCount(materialIndex);
    }
  }
}
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

Multipatch Class
Multipatch Members