AnsweredAssumed Answered

GpsLayer and MVVM issues

Question asked by sheled on Jul 26, 2012
Latest reply on Aug 2, 2012 by akajanus-esristaff
Hello,

I am trying to use the GpsLayer under MVVM architecture, however, as it seems - no luck yet.

Binding the GeoPositionWatcher to a property when using MVVM does not work (getter not reached).
The reason is that GpsLayer inherits DependencyObject, but DependencyObject does not implement DataContext.
So actually it is impossible to bind the DependencyProperty to a property on the ViewModel.
Microsoft states that the DO should inherit the DataContext from the containing FrameworkElement (esri:map in this case), but that in fact doesn't happen.

Would love for some opinion from ESRI about this - have you tested this in MVVM architecture?

Also - when a certain object/class implements visual capabilities (GpsLayer has  a GraphicsLayer, that allows actual creation of geometries, shapes, lines, etc), it should inherit FrameworkElement - providing the infrastructure of inheritance through dependency properties that the WPF Dependency Object+Dependency Property Backing data store offers.

Not to mention - The actual inheritance through DependencyObject  and not through FrameworkElement might cause visual problems (And I have personally had situations where the layer stopped refreshing and stopped redrawing, I would suggest this is related to the WPF rendering engine).

Outcomes