Select to view content in your preferred language

How to delegate feature selection tool events or is there?

431
0
02-13-2020 07:30 PM
by Anonymous User
Not applicable

Hi Guys,

There are a few tools in ArcGIS pro which can perform feature selection like below.

My question is that is there any event I can subscribe/delegate events from my ArcGIS pro addin code to the selection?

Not sure I am in right track, currently I am using this way by subscribing the OnMapSelectionChangedEvent.

Please advice if there is better way to perform.

private async void OnMapSelectionChangedEventAsync(MapSelectionChangedEventArgs obj)
        {
            MessageBox.Show("Selection has changed");
            if(MapView.Active != null && MapView.Active.Map != null)
            {
                Dictionary<MapMember, List<long>> selection =  await QueuedTask.Run(() =>
                {
                    return MapView.Active.Map.GetSelection();
                });

                if(selection.Count > 0)
                {
                    //Lets process there is some selection                  
                    System.Diagnostics.Debug.Write("There are some selection");
                }
                else
                {
                    System.Diagnostics.Debug.Write("There is no any selection to perform the feature selection process");
                }
            }

        }

Best Regards,

Than

0 Kudos
0 Replies