title: XAML trigger template to set visibilty based on another element
body: <p>I have several StackPanels that change visibility based on ToggleButtons. The code below works if I replace <code>Tag</code> with <code>btn1</code> on the <code>DataTrigger</code>-lines.
  How do I use the value of the <code>Tag</code> property?</p>
  
  <pre><code>&lt;Window x:Class="MyTestApp.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="TestApp"&gt;
  
      &lt;Window.Resources&gt;
          &lt;Style x:Key="panelStyle" TargetType="{x:Type StackPanel}"&gt;
              &lt;Style.Triggers&gt;
                  &lt;DataTrigger Binding="{Binding ElementName=Tag, Path=IsChecked}" Value="False"&gt;
                      &lt;Setter Property="StackPanel.Visibility" Value="Collapsed" /&gt;
                  &lt;/DataTrigger&gt;
                  &lt;DataTrigger Binding="{Binding ElementName=Tag, Path=IsChecked}" Value="True"&gt;
                      &lt;Setter Property="StackPanel.Visibility" Value="Visible" /&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
  
      &lt;/Window.Resources&gt;
  
      &lt;WrapPanel&gt;
          &lt;ToggleButton Content="One" Name="btn1" /&gt;
          &lt;ToggleButton Content="Two" Name="btn2" /&gt;
  
          &lt;StackPanel Style="{StaticResource panelStyle}" Tag="{Binding btn1}"&gt;
              &lt;Label Content="Data to panel 1" /&gt;
          &lt;/StackPanel&gt;
  
          &lt;StackPanel Style="{StaticResource panelStyle}" Tag="{Binding btn2}"&gt;
              &lt;Label Content="Data to panel 2" /&gt;
          &lt;/StackPanel&gt;
  
      &lt;/WrapPanel&gt;
  
  &lt;/Window&gt;    
  </code></pre>
  
  <p>This question is very similar, but I'm missing details on how to pass an element name.<br>
  <a href="https://stackoverflow.com/questions/1913730/xaml-generic-textbox-stylewith-triggers-parameters">XAML - Generic textbox stylewith triggers / parameters?</a></p>