title: Change WPF UserControl depending on a Property of a TreeViewItem
body: <p>My application shows a TreeView on the left with hierarchical ordered items which are all the same type. All the items have a dependency property which can have one of two values. This value is an enum. Depending on this value I want to show one of two UserControls on the left. My idea was to insert both controls and set their opacity to 0. Then I wanted to insert a Style with a DataTrigger that triggers the opacity depending on the enum's value. But I can not access the properties of one control from the other control's DataTrigger; and the trigger does not seem to recognize the enum's value.</p>
  
  <p>The enum:</p>
  
  <pre><code>public enum IdentityType
  {
      Person,
      OrganisationUnit
  }
  </code></pre>
  
  <p>The XAML:</p>
  
  <pre><code>&lt;TreeView Grid.Column="0" Grid.Row="1" Background="AntiqueWhite" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding Identities}" x:Name="OiTree"&gt;
      &lt;TreeView.ItemTemplate&gt;
          &lt;HierarchicalDataTemplate ItemsSource="{Binding Childs}"&gt;
              &lt;TextBlock Text="{Binding}"/&gt;
          &lt;/HierarchicalDataTemplate&gt;
      &lt;/TreeView.ItemTemplate&gt;
  &lt;/TreeView&gt;
  
  &lt;Controls:UcPerson Grid.Column="1" Grid.Row="1" Opacity="0"&gt;
      &lt;Controls:UcPerson.Style&gt;
          &lt;Style TargetType="Controls:UcPerson"&gt;
              &lt;Style.Triggers&gt;
                  &lt;DataTrigger Binding="{Binding Path=Type, ElementName=OiTree.SelectedItem}" Value="Person"&gt;
                      &lt;Setter Property="Opacity" Value="1"/&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/Controls:UcPerson.Style&gt;
  &lt;/Controls:UcPerson&gt;
  
  &lt;Controls:UcOrgUnit Grid.Column="1" Grid.Row="1" Opacity="0"&gt;
      &lt;Controls:UcOrgUnit.Style&gt;
          &lt;Style TargetType="Controls:UcOrgUnit"&gt;
              &lt;Style.Triggers&gt;
                  &lt;DataTrigger Binding="{Binding Path=Type, ElementName=OiTree.SelectedItem}" Value="OrganisationUnit"&gt;
                      &lt;Setter Property="Opacity" Value="1"/&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/Controls:UcOrgUnit.Style&gt;
  &lt;/Controls:UcOrgUnit&gt;
  </code></pre>