In WPF working with the MVVM design pattern, I am trying to click on a control in a Window or child of a control in a window that was a templated control.

The problem is that I need the X & Y position of the mouse anywhere on the canvas or grid, and have to press the control based on a flag going true in my view model. Where should the code go, in the view or the viewmodel? The flag is set by hardware.

I have to find the control under the mouse and perform a click command from the view model.
How would I do that? Also Am I violating the MVVM pattern? This is Huge for me right now.

I sure could use a sourcecode example as I am new to WPF.

- EagleSparrow