I am updating my AddIns and switching to SDK 3.0/.Net 6
FeatueLayer.RemoveAllDefinitionFilters() is not resolved the closest function I found is FeatureLayer.RemoveAllDefinitionQueries(). The same issue exists also with FeatureLayer.DefinitionFilter but there is FeatureLayer.DefinitionQuery. I still have many errors I can't run my AddIn. Is there anyone who knows my assumption is right?
https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic11585.html
that is correct. RemoveAllDefinitionQueries() will do the same thing
Hi,
At 3.0, BasicFeatureLayer definition queries have changed. The ProConcepts: 3.0 Migration Guide covers this topic. There are also various code snippets that can help you in this wiki.
var us_states = MapView.Active.Map.GetLayersAsFlattenedList() .OfType<FeatureLayer>().First(lyr => lyr.Name == "US States"); QueuedTask.Run(() => { us_states.SetDefinitionQuery("STATE_NAME = 'Iowa'"); //equivalent to... var def_query = new DefinitionQuery() { Name = "A Name that is Unique", WhereClause = "STATE_NAME = 'Iowa'" }; us_states.InsertDefinitionQuery(def_query, true); var active_def_query = us_states.ActiveDefinitionQuery; string where_clause = us_states.DefinitionQuery;//just the where clause string //remove the active query us_states.RemoveActiveDefinitionQuery(); //remove using name us_states.RemoveDefinitionQueries(new List<string> { def_query.Name }); //use LINQ to get just a specific query var def_query = us_states.DefinitionQueries.FirstOrDefault( dq => dq.Name == "Query def name");
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.