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
Solved! Go to Solution.
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;
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;
Hi,
Thank you for the snippet. I was somehow close to your solution, did not do casting!
have a nice day,
Adam
@GKmieliauskas Is there a pattern for setting up two-way binding between dockpane elements and an INotifyPropertyChanged enabled class in the dockpane’s view model? I am not seeing anything in the ProGuide and have had no success trying to implement it myself.
Hi,
@Jeff-Reinhart Look at the DatastoresDefinitionsAndDatasets sample. DataPath property has two-way binding. DockPane implements INotifyPropertyChanged. OnPropertyChanged is implemented inside
SetProperty(ref _dataPath, value, () => DataPath);
You can change it to expanded form:
_dataPath = value;
OnPropertyChanged();
That example is immensely helpful. Thanks for helping out a C# rookie.