locked
How to use a DataTriggerBehavior with an EventTriggerBehavior

    Question

  • I have an EventTriggerBehavior as shown below that works as designed when inserted into a gridview that is part of a Windows 8.1 Store app.

    <interactivity:Interaction.Behaviors>
     <core:EventTriggerBehavior EventName="ItemClick">
      <behaviors:NavigateWithEventArgsToPageAction TargetPage="UI.Views.GroupDetailPage"
           EventArgsParameterPath="ClickedItem.Title" />
     </core:EventTriggerBehavior>
    </interactivity:Interaction.Behaviors>

    However, I only want the ItemClick feature to work when the item has a count property greater than zero, such as in the following:

    <interactivity:Interaction.Behaviors>
     <core:DataTriggerBehavior Binding="{Binding TotalNumber}" ComparisonCondition="NotEqual" Value="0">
      <core:EventTriggerBehavior EventName="ItemClick">  
       <behaviors:NavigateWithEventArgsToPageAction TargetPage="UI.Views.GroupDetailPage"
           EventArgsParameterPath="ClickedItem.Title" />
      </core:EventTriggerBehavior>
     </core:DataTriggerBehavior>
    </interactivity:Interaction.Behaviors>

    The above code does not compile, so how can I apply a condition to the EventTriggerBehavior, assuming that doing so is possible?

    • Moved by Cloud_TS Friday, January 23, 2015 8:11 AM move to appropriate forum
    Thursday, January 22, 2015 10:58 PM

Answers