Select to view content in your preferred language

Locator control in custom UI

394
1
07-17-2023 01:00 AM
CarlosK
Emerging Contributor

 

Hi,

I am using Pro Locator control in my custom UI. I have couple of other controls as well like a button in that UI. Based on the locator results selection, I have storing some info in a dictionary for further use. But based on that data I also need to enable/disable my other controls for example that button. And if selection is cleared I also have to disable the button in that case as well. But the SelectedGeocodeResultsChanged is triggered 2 times when result is selected, first time having no data and second time having the data. But if I am clearing the selection results then it is only one time with no data. Why is that? Because due to  this I am not able to know when to clear my dictionary based on which I have enable/disable my button.

Tags (1)
0 Kudos
1 Reply
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Is the UI that you are using in a dockpane or on the ribbon?   If you use a custom locator on a dockpane then you can use MVVM as shown in this sample: 

arcgis-pro-sdk-community-samples/Map-Authoring/GeocodingTools at master · Esri/arcgis-pro-sdk-commun...

if you use MVVM you don't have to rely on any events, instead you can use the setter of the 'SelectedItem' dependency property to drive your enable/disable logic.

0 Kudos