// 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);
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