Access ViewModel from a ProWindow

75
1
Jump to solution
11-14-2019 06:21 AM
Highlighted
New Contributor III

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)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
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
Highlighted
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