title: Change label content when click a button
body: <p>I want a <code>StackPanel</code> with dynamically added buttons that update a label content when clicked. I use <code>Button.Click="ChildsButtonClick"</code> to assign the event from the <code>StackPanel</code> to it's children and update the label content. But, is it possible to do it only with <code>XAML</code> and <code>Bindings</code>, <code>Triggers</code>, etc..? As you suppose I'm new to this world.</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;StackPanel HorizontalAlignment="Left"
                  Height="165"
                  VerticalAlignment="Top"
                  Width="465"
                  Button.Click="ChildsButtonClick"&gt;
          &lt;Button x:Name="button"
                  Content="Button1"
                  d:LayoutOverrides="Height" /&gt;
          &lt;Button x:Name="button1"
                  Content="Button2"
                  d:LayoutOverrides="Height" /&gt;
      &lt;/StackPanel&gt;
      &lt;Label x:Name="label"
             Content="Label"
             HorizontalAlignment="Left"
             Margin="0,195,0,0"
             VerticalAlignment="Top" /&gt;
  </code></pre>
  
  <p>CS:</p>
  
  <pre><code>private void ChildsButtonClick(Object sender, RoutedEventArgs e)
      {
          Button a = e.Source as Button;
          if (a != null)
          {
              label.Content = a.Content;
          }
      }
  </code></pre>
  
  <p>Is there a way to do this without the event?</p>