AnsweredAssumed Answered

MVVM?

Question asked by hen01@co.henrico.va.us on Mar 9, 2015
Latest reply on Mar 18, 2015 by hen01@co.henrico.va.us

I'm revamping some WPF Runtime apps to the new .NET API - Desktop. I've started to use the MVVM pattern but there seems to be some missing features. The first is that:

"objects inside the MapView control are not in the page's control hierarchy and, therefore, cannot be referenced from the page."

 

So the DataContext for the MapView isn't available down the control hierarchy? So in order to bind data to a map overlay I need to pass in the MapView object to the ViewModel and bind it programatically like so:

 

   var tip = _mapView.FindName("mapTip") as System.Windows.FrameworkElement;
   tip.DataContext = graphic;

 

Doesn't this negate one of the major benefits to MVVM data-binding?

 

Similarly, symbols can't use data-binding? For example I want a TextSymbol's text to be a Graphic attribute named LABEL. I cannot do something like:

 

<esri:TextSymbol Text="{Binding Attributes[LABEL]}" ...

 

Finally, the examples all use code-behind pages and events, but it seems we're encouraged to use MVVM. So I guess my question is are enterprise-class applications really possible with the .NET API using MVVM?

 

Caveat: I'm relatively new to MVVM, but an having a hard time seeing how all this is going to work.

Outcomes