Create a new instance of the inspector class.
Load a feature from a layer into the inspector
// get the first feature layer in the map
var firstFeatureLayer = ArcGIS.Desktop.Mapping.MapView.Active.Map.GetLayersAsFlattenedList().
OfType<ArcGIS.Desktop.Mapping.FeatureLayer>().FirstOrDefault();
// create an instance of the inspector class
var inspector = new ArcGIS.Desktop.Editing.Attributes.Inspector();
// load the feature with ObjectID 'oid' into the inspector
await inspector.LoadAsync(firstFeatureLayer, oid);
Inspector.AddValidate
var insp = new Inspector();
insp.LoadSchema(featLayer);
var attrib = insp.Where(a => a.FieldName == "Mineral").First();
attrib.AddValidate(() =>
{
if (attrib.CurrentValue.ToString() == "Salt")
return Enumerable.Empty<ArcGIS.Desktop.Editing.Attributes.Attribute.ValidationError>();
else return new[] { ArcGIS.Desktop.Editing.Attributes.Attribute.ValidationError.Create("Error", ArcGIS.Desktop.Editing.Attributes.Severity.Low) };
});
Target Platforms: Windows 11, Windows 10, Windows 8.1
ArcGIS Pro version: 3.0 or higher.