Select to view content in your preferred language

WPF Dockpane: How to auto-refresh Listbox contents with changes from the Pro Content list

755
2
Jump to solution
01-10-2024 01:40 PM
anonymous_geographer
Frequent Contributor

Hello everyone,

I have a Pro SDK add-in tool (a dockpane). It has a listbox that I populate with the feature layers from the Contents pane. Currently, it's using a Refresh button that the end-user can manually click to update the listbox if anything changes within the Contents pane. That's working fine. However, I'd like to enhance this a bit to auto-update the listbox based on "live" changes from the Contents pane. Examples could be if someone imports a new feature layer into the map or a feature layer gets renamed while the dockpane is open.

anonymous_geographer_0-1704922591965.png


I'm starting to get the hang of Pro SDK and WPF/XAML, but still have a lot to learn. Is it possible to "monitor" the Contents pane and auto-update the listbox? If so, what approach would I use to accomplish that? Thanks for any advice.

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

Look at the LayerSnapModes sample. It uses ActiveMapViewChangedEvent, LayersAddedEvent and LayersRemovedEvent to populate snap list.

View solution in original post

2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Look at the LayerSnapModes sample. It uses ActiveMapViewChangedEvent, LayersAddedEvent and LayersRemovedEvent to populate snap list.

anonymous_geographer
Frequent Contributor

Thanks! That got me on the right track and is working for me now. Ended up implementing these subscriptions:

ActiveMapViewChangedEvent.Subscribe(func_OnActiveMapViewChanged); // if active map changes
LayersAddedEvent.Subscribe(func_OnLayersAddRem); // if feature layer added
LayersRemovedEvent.Subscribe(func_OnLayersAddRem); // if feature layer removed
LayersMovedEvent.Subscribe(func_OnLayersAddRem); // if feature layer reordered
MapMemberPropertiesChangedEvent.Subscribe(func_OnMapMembersPropertyChanged); // if feature layer renamed



0 Kudos