title: WPF/XAML - binding control commands to parent window's viewmodel?
body: <p>I have an application, and I have an assembly.</p>
  
  <p>In the application, I have a window, and in the assembly I have a user control.</p>
  
  <p>There is an instance of the user control in the window.</p>
  
  <p>Both the user control and the window are backed by separate viewmodels.</p>
  
  <p>In the user control, there is a button.  The button should be enabled/disabled based on the state of the user control's viewmodel. When the button is clicked, processing needs to be done, based on the information in the user control's viewmodel, but it needs to be done by the window's viewmodel.  (There are aspects of what needs to be done that are, and should be, outside of the scope of the user control.)</p>
  
  <p>And here's the twist - this user control won't be used exclusively in this window, it might be used in another, or in a control that is used in a third.  The user control can't be allowed to know what kind of window or control contains it, or is handling the process when its button is clicked.</p>
  
  <p>So, what to do?</p>
  
  <p>Define a command in the assembly, and bind the user control's button to it, passing the user control's viewmodel as the command parameter?  How, then, do I bind the command to the window's viewmodel?</p>
  
  <p>Or should I define the command in the user control's viewmodel, then raise an event to tell the parent window that the appropriate action needs to be taken?</p>
  
  <p>It's not clear to me which is cleaner.</p>