Getting Layers events

743
3
12-17-2020 12:16 AM
mody_buchbinder
Occasional Contributor III

I am trying to get events for layers such as visible on/off or symbology change.

I can get the DrawCompleteEvent but it is very hard to understand what was changed.

I did not get the MapMemberPropertiesChangedEvent fire when I turn visibility on/off.

Any other ideas?

Thanks

0 Kudos
3 Replies
KirkKuykendall1
Occasional Contributor III

Does the PropertyChanged event fire for a featurelayer when its IsVisible property is changed?

If it does, I suppose you'd need to traverse through the layers to handle the situation where IsVisible is true, but it's contained within a GroupLayer whose IsVisible is false.

0 Kudos
mody_buchbinder
Occasional Contributor III

Hi Kirk

If I have to check all layers in TOC and compare to the previous state I can use the Draw event.

It is not simple to understand symbology change or other small changes (labeling, layer name etc.)

0 Kudos
KirkKuykendall1
Occasional Contributor III

Yeah, I don't see an easy way to do that.

Maybe try maintaining a List<string> somewhere and populate it with each layer's serialized definition. 

That way, when the after DrawCompleteEvent fires you could loop through each layer, serialize its definition and compare with the string in the list to see if anything has changed (like labeling, layer name etc.)

 

0 Kudos