I know its an anti pattern to have WPF specific connections to the presentation model.
But in this case i cant avoide it (I use SLIM DX for joystick input and it requires the handle).
So is there a way from the presenation model to get the handle of the window connected to the model?
Thanks
If I understand, if your view model is inherited from Screen you can call GetView, cast it to the type of your view, and get access to a control on the view.
An alternative if you don’t want to reference your view from the VM it might be possible to do what you need in a coroutine.
“It’s a fairly simple interface to implement. Simply write your code in the “Execute” method and be sure to raise the “Completed” event when you are done, whether it be a synchronous or an asynchronous task. Because coroutines occur inside of an Action, we provide you with an ActionExecutionContext useful in building UI-related IResult implementations. This allows the ViewModel a way to declaratively state it intentions in controlling the view without having any reference to a View or the need for interaction-based unit testing. Here’s what the ActionResultContext looks like:”
http://caliburnmicro.codeplex.com/wikipage?title=IResult%20and%20Coroutines&referringTitle=Documentation