Select to view content in your preferred language

Maptool updates Dockpane UI. How to access to data binding property from other class?

478
2
Jump to solution
03-22-2024 07:59 AM
nita14
by
Frequent Contributor

Dear Community,

I am struggling to find a way to update an UI element from other class than <*>ViewModel.cs.

I have a docpane with a WaitingCursorControl. Its visibility is cotrolled via data binding in the ViewModel class. However, I do have another MapTool class where I would like to set the visibility of the WaitingCursorControl in the dockpane.

How can access the data binding property from a different class than ViewModel? Any hints?

Thanks!

Adam 

 

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

1. Find your dockpane:

            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
            if (pane == null)
                return;

2. Cast pane to you ViewModel class and access public property:

(pane as YourDockpaneViewModel).YourPropertyName = value;

View solution in original post

2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

1. Find your dockpane:

            DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
            if (pane == null)
                return;

2. Cast pane to you ViewModel class and access public property:

(pane as YourDockpaneViewModel).YourPropertyName = value;
nita14
by
Frequent Contributor

Hi,

Thank you for the snippet. I was somehow close to your solution, did not do casting!

have a nice day,

Adam

0 Kudos