Select to view content in your preferred language

How do I get the OK button event in ArcGIS Pro SDK after manually adding a data source to a layer file?

480
2
Jump to solution
03-30-2022 11:34 PM
by Anonymous User
Not applicable

Hi,

In ArcGIS Pro, I have two layer files that only contain symbology. When we manually set the source by right-clicking a layer, the layer properties window opens, and we enter the path to it in the set Data source field.

After that, we pressed the OK button; does anyone know the function/API for that, so that I can retrieve that path from the backend using C# and populate the table names and their corresponding columns in my TreeView controller?

ShabinaBano_0-1648708092451.png

 

Thanks in advance!

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

You need to listen PropertyChanged event on each layer, o layers you want.

                var layerList = MapView.Active.Map.GetLayersAsFlattenedList().OfType<Layer>();
                foreach(var layer in layerList)
                {
                    layer.PropertyChanged += MyLayerPropertyChanged;
                }
        private void MyLayerPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            // your code here
        }

View solution in original post

2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

You need to listen PropertyChanged event on each layer, o layers you want.

                var layerList = MapView.Active.Map.GetLayersAsFlattenedList().OfType<Layer>();
                foreach(var layer in layerList)
                {
                    layer.PropertyChanged += MyLayerPropertyChanged;
                }
        private void MyLayerPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            // your code here
        }
by Anonymous User
Not applicable

Thanks, it worked perfectly fine for me. 🙂

0 Kudos