title: WPF DataTrigger and button using PRISM
body: <p>I have a question about clarifiying the Data Context in WPF. I have a PRISM based application. I am attempting to put a DataTrigger on a Button control. This Button control is configured to use a PRISM command interpreter.</p>
  
  <pre><code>&lt;Button 
     Grid.Column="0"                             
     Content="{Resx AdvancedTroubleShootingButtonLabel}" 
     prism:Click.Command="{Binding AdvancedTroubleShootingCommand}"
   &gt;
     &lt;Button.Resources&gt;
       &lt;Style 
         TargetType="{x:Type Button}"  BasedOn="{StaticResource CDMWrappedButtonStyle}"&gt;
  
         &lt;Style.Triggers&gt;
  
           &lt;DataTrigger Binding="{Binding Path=SizerVisible, ElementName=SecuritySizer}" Value="False" &gt;
              &lt;Setter Property="Button.IsEnabled" Value="True" /&gt;
           &lt;/DataTrigger&gt;
  
           &lt;DataTrigger Binding="{Binding Path=SizerVisible, ElementName=SecuritySizer}" Value="True" &gt;
             &lt;Setter Property="Button.IsEnabled" Value="False" /&gt;
           &lt;/DataTrigger&gt;
         &lt;/Style.Triggers&gt;
  
       &lt;/Style&gt;
     &lt;/Button.Resources&gt;
  &lt;/Button&gt;
  </code></pre>
  
  <p>My assumption was that the DataTriggers would use the specified elementName for the Datacontext of the Trigger. When I test this XAML the trigers do not run. If I remove the PRISM command syntax (and hook into the standard Button click event) and test, then the triggers fire. </p>
  
  <p>What I would like to know is why would the PRISM command handler [syntax] cause the triggers to not use the DataContext identified in the Trigger script?</p>