ArcGIS Pro 2.6 API Reference Guide
SetCustomProperty(String[],String[]) Method
Example 

ArcGIS.Desktop.Layouts Namespace > Element Class > SetCustomProperty Method : SetCustomProperty(String[],String[]) Method
String
String
Sets multiple CustomProperty values for the element. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public void SetCustomProperty( 
   string[] keys,
   string[] values
)
Public Overloads Sub SetCustomProperty( _
   ByVal keys() As String, _
   ByVal values() As String _
) 

Parameters

keys
String
values
String
Exceptions
ExceptionDescription
This method must be called within the lambda passed to QueuedTask.Run.
Remarks
This method was created so developers have a way to uniquely assign a value or multiple values to an element that can not be changed in the UI and therefore provides a predictable way to find an element. Each entry has a key/value pair and you find the value using the GetCustomProperty method. You can overwrite values simply be reentering the same key with a different value. There are no methods to remove keys.
Example
//Set a custom property on an element.

//Perform on the worker thread
await QueuedTask.Run(() =>
{
  element.SetCustomProperty("MyKeyString", "MyValueString");
});
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

Element Class
Element Members
Overload List