title: How to pass a view model in custom event args
body: <p>I use the Caliburn Micro framework. That doesn't actually matter. The point is, that I publish an event in a view model, which contains the new view model to be shown in its event args. The event gets catched in the ShellViewModel (you could see it as the root view model), which actually activates the new view model. </p>
  
  <p>So how could I pass the view model in my event args? Currently it looks like this:</p>
  
  <pre><code>// where it gets published; "AnotherViewModel" is the actual class
  public void AMethod()
  {
      var args = new ViewModelChangedEventArgs { ViewModelType = typeof(AnotherViewModel) };
      PublishEvent(args);
  }
  
  // event handler
  public void Handle(ViewModelChangedEventArgs message)
  {  
      if (message.ViewModelType == typeof(AnotherViewModel))
      {
          // activate AnotherViewModel
      }
      if (message.ViewModelType == typeof(FooViewModel))
      {
          // activate FooViewModel
      }
  }
  </code></pre>
  
  <p>This method seems not very elegant to me. Do you have any better ideas?</p>