Access ViewModel from a ProWindow

579
1
Jump to solution
11-14-2019 06:21 AM
Vidar
by
Occasional Contributor II

Hi,

How would you go about trying to access the data from a ViewModel (belonging to a ProWindow) from another ViewModel?

I have tried to find some way of doing it via the FrameworkApplication - in the same style as the DockPaneManager - but alas there does not seem to be an equivalent for a ProWindow.

Should I hold a reference to the ViewModel in the Module class?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

You can use the Module class (which is a singleton) to register your dockpane(s) for access throughout your add-in or even from other add-ins.  The pattern is utilized by this sample for internal access: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/MapToolIdentify...https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/MapToolIdentify....

Look in the Module1 class for usage of this property:  

internal static MapToolIdentifyDockpaneViewModel MapToolIdentifyDockpaneVM { get; set; }

View solution in original post

1 Reply
Wolf
by Esri Regular Contributor
Esri Regular Contributor

You can use the Module class (which is a singleton) to register your dockpane(s) for access throughout your add-in or even from other add-ins.  The pattern is utilized by this sample for internal access: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/MapToolIdentify...https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/MapToolIdentify....

Look in the Module1 class for usage of this property:  

internal static MapToolIdentifyDockpaneViewModel MapToolIdentifyDockpaneVM { get; set; }