title: using EventToCommand & PassEventArgsToCommand :: how to get sender, or better metaphor?
body: <p>The point of what I'm doing is that there are a lot of things that need to happen in the viewmodel, but when the view has been loaded, not on constructor. I could wire up event handlers and send messages, but that just seems kinda sloppy to me. I'm implementing a base view and base viewmodel where this logic is contained so all my views get it by default, hopefully.</p>
  
  <p>Perhaps I can't even get what I'm wanting: the sender. I just figured this is what RoutedEventArgs.OriginalSource was supposed to be? </p>
  
  <p>[Edit] In the meantime, I've hooked up an EventHandler in the xaml.cs, and sure enough, OriginalSource is null there as well. So I guess really I need to know if it's possible to get a reference to the view/sender in the Command as well? [/Edit]</p>
  
  <p>My implementation requires that a helper class to my viewmodels which is responsible for creating 'windows' knows of the 'host' control that all the windows get added to. i'm open to suggestions for accomplishing this outside the scope of using eventtocommand. :)</p>
  
  <p>
      
          
      
      
          
      
  </p>
  
  <p>(the code for Unloaded is the same)</p>
  
  <pre><code>    #region ViewLoadedCommand
      private RelayCommand&lt;RoutedEventArgs&gt; _viewLoadedCommand = null;
      /// &lt;summary&gt;
      /// Command to handle the control's Loaded event. 
      /// &lt;/summary&gt;
      public RelayCommand&lt;RoutedEventArgs&gt; ViewLoadedCommand
      {
          get
          {
              // lazy-instantiate the RelayCommand on first usage
              if (_viewLoadedCommand == null)
              {
                  _viewLoadedCommand = new RelayCommand&lt;RoutedEventArgs&gt;(
                      e =&gt; this.OnViewLoadedCommand(e));
              }
              return _viewLoadedCommand;
          }
      }
      #endregion ViewLoadedCommand
  
  
      #region View EventHandlers
      protected virtual void OnViewLoadedCommand(RoutedEventArgs e)
      {
          EventHandler handler = ViewLoaded;
          if (handler != null)
          {
              handler(this, e);
          }
      }
      #endregion
  </code></pre>