title: Wpf Binding to Visibility of WindowsFormHost
body: <p>I have a WindowsFormsHost whose visibility changes from "Visible" to "Collapsed" and vice versa based on certain triggers.  I also want to be able to bind this "Visibility" to a variable as I need to be able to look at the Visibility field for certain reasons, and I can't just "look" at it because they're in two different projects (the style which holds this WindowsFormsHost is in basically a resources project).</p>
  
  <p>Anyways, I have this:</p>
  
  <pre><code>    &lt;WindowsFormsHost Grid.Row="2" Name="PART_ToggleContainer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
       Visibility="{Binding Path=IsVisible, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged,Source={StaticResource StatusProvider}}"
      &gt;
  </code></pre>
  
  <p>And in the control template parent I have a multitrigger which checks a couple dependency fields and tries to hide the form (and the hiding works).</p>
  
  <pre><code>&lt;ControlTemplate.Triggers&gt;
        &lt;MultiTrigger&gt;
         &lt;MultiTrigger.Conditions&gt;
          &lt;Condition Property="IsBeingDragged" Value="True"/&gt;
          &lt;Condition Property="IsWorking" Value="False" /&gt;
         &lt;/MultiTrigger.Conditions&gt;
         &lt;Setter Property="IsVisibleDProp" Value="False"/&gt;
         &lt;Setter TargetName="PART_ToggleContainer" Property="Visibility" Value="Collapsed" /&gt;
        &lt;/MultiTrigger&gt;
  &lt;/ControlTemplate.Triggers&gt;
  </code></pre>
  
  <p>Here's the binding I use for Visibility, "IsVisible", in the class that gets used as the data provider.</p>
  
  <pre><code>private Visibility IsVisibleProperty = Visibility.Visible;  
  
  
  public bool bIsVisible
    {
     get { return bIsVisibleProperty; }
     set
     {
      if (bIsVisibleProperty == value)
      {
       return;
      }
      bIsVisibleProperty = value;
      OnPropertyChanged("IsVisible");
     }
    }
  </code></pre>
  
  <p>The setter isn't hit when the property changes.</p>
  
  <p>Any clues?</p>
  
  <p>I also tried a workaround, to set this "IsVisibleDProp" dependency that resides in the same place as "IsBeingDragged" and "IsWorking", but it never hits the setter either (though I do set the other two programmatically, and IsVisibleDPropis set using the multitrigger).</p>
  
  <p>Thanks.</p>