title: Set property in ViewModel within other View
body: <p>I have a WPF-Application with a <code>Window</code> and a <code>UserControl</code>. The <code>UserControl</code> is implemented with the MVVM-Pattern. So in the view I have a <code>Label</code> which displays the value of a <code>string</code>-property called InfoMessage in the ViewModel.</p>
  
  <p>In the <code>Window</code> I added an instance of this <code>UserControl</code> by</p>
  
  <pre><code>&lt;views:ItemInfoView Grid.Row="3" Grid.Column="1" x:Name="itemInfoView"/&gt;
  </code></pre>
  
  <p>Now I want to set the InfoMessage from the XAML of my <code>Window</code>. Currently I have no idea how to achieve this in xaml. In code-behind I could access the <code>DataContext</code> of my control and cast it to ItemInfoViewModel and the set the value like:</p>
  
  <pre><code>((ItemInfoViewModel)itemInfoView.DataContext).InfoMessage = "Hello World";
  </code></pre>
  
  <p>But I hope there's a way to do this in pure XAML. Does anyone know if this is possible and how?</p>