I’m trying to whip my brain into MVVM mode here.
I have a Grid in my view, and various methods for manipulating it and adding shapes to it in my viewmodel. I realize that I should try to avoid that sort of thing in the VM, so I moved those methods into there own class. What I’m trying to figure out is
a) Where should an instance of the new class be created? Currently I’ve got it in my VM, using
IoC.Get()
b) The NewClass needs to get a hold of the Grid in the view, how can I do that?
(The only thing I can think of is to have the VM get a reference to its View, and pass the Grid
into the NewClass, but that doesn’t seem like the best way to do it)
A) look at using Coroutines if you need to manipulate the grid in a way you’re not able to through the viewmodel. A reference to the view gets passed in the ActionExecutionContext.