SetDefinitionQuery Method (BasicFeatureLayer)
Sets the where clause of the active definition query.
This method must be called on the MCT. Use QueuedTask.Run.
Apply A Definition Query Filter to a Feature Layer2
var us_parks = map.GetLayersAsFlattenedList()
.OfType<FeatureLayer>().First(l => l.Name == "USNationalParks");
QueuedTask.Run(() =>
{
//inserts a new definition query and makes it active
//it will be assigned a unique name
us_parks.SetDefinitionQuery("STATE_ABBR = 'CA'");
});
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3.0 or higher.