Events between Classes not knowing each other? (MVVM)
<p>again me^^</p>

<p>I searched the forum but I think I didn't found a solution which suits my needs.
I got a MainView with a MainViewModel and open a new window MediaPlayerView with a kind of MVVM Windowopener (delegate). This MediaPlayerView has another MediaPlayerViewModel as DataContext. My Question is, how I can handle Events from my MediaPlayerView in my MainViewModel? I.e. I want my MainViewModel to do something if my MediaPlayerView.Closed Event is fired but my MediaPlayerView is made through a delegate and does not "know" the ViewModel nor the other way round. Can I rewrite it to suit my needs?</p>

<p>Here the Code of the Delegate I found here:</p>

<pre><code>public interface IWindowFactory&lt;T&gt;
{
     void CreateNewWindow(T t);
}
public class MediaPlayerWindowFactory : IWindowFactory&lt;string&gt;
{
    public void CreateNewWindow(string directLink)
    {
         MediaPlayerView window = new MediaPlayerView(directLink);
         window.Show();
    }
}
</code></pre>

<p>And I open my window in my MainViewModel with</p>

<pre><code>private readonly MediaPlayerWindowFactory windowFactory;
openMediaPlayerWindow(link);

private void openMediaPlayerWindow(string link)
{
    windowFactory.CreateNewWindow(link);
}
</code></pre>

<p>If this does not work, could you tell me another way to open windows in MVVM with event handling supported?</p>