How to tell when the linking tool is active

I’m using some ChangePropertyAction trigger actions in my node template to turn the opacity of a nested element on and off. These actions are tied into EventTriggers that listen for MouseEnter and MouseLeave events on my NodePanel. It looks like when the LinkingTool becomes active it (or something else) performs a mouse capture (understandable in this scenario). But a side effect of the mouse capture is my node panel never gets a MouseLeave event and my opacity is stuck in the wrong state.

How do I tell from XAML when the LinkingTool becomes active? (LinkingTool.Active is not a dependency property so I don’t think I can use it with a PropertyChangedTrigger.)

Normally one checks Diagram.CurrentTool is LinkingTool or some similar C# expression.

I suppose you make that available in a data-binding by using a converter.

Thanks, that’s exactly what I needed! Here’s the XAML from my node template in case anyone else is interested:

[code]<i:Interaction.Triggers>
  <ei:PropertyChangedTrigger Binding="{Binding Diagram.CurrentTool, RelativeSource={RelativeSource TemplatedParent}}">
    <i:Interaction.Behaviors>
      <ei:ConditionBehavior>
        <ei:ConditionalExpression>
          <ei:ComparisonCondition LeftOperand="{Binding Diagram.CurrentTool, RelativeSource={RelativeSource TemplatedParent}}"
            RightOperand="{Binding Diagram.LinkingTool, RelativeSource={RelativeSource TemplatedParent}}" />
          </ei:ConditionalExpression>
        </ei:ConditionBehavior>
      </i:Interaction.Behaviors>
    <ei:ChangePropertyAction TargetName="TheTargetControl"
      PropertyName="Opacity"
      Value="0" />
  </ei:PropertyChangedTrigger>
</i:Interaction.Triggers>[/code]

Well, that wasn’t what I was thinking of, but I suppose that could work too. Does that package work in Silverlight also?

Most definitely. I’m cross compiling the same XAML for both Silverlight and WPF. Works like a charm.