The title pretty much explains the question.
I have the following in the view in a Template:
<i:Interaction.Triggers>
<i:EventTrigger EventName="SizeChanged">
<i:InvokeCommandAction>
<i:InvokeCommandAction.Command>
<Binding Source="{StaticResource eventBindingHelper}" Path="DataC.SizeChangedCommand"></Binding>
</i:InvokeCommandAction.Command>
<i:InvokeCommandAction.CommandParameter>
<Binding RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type igDP:LabelPresenter}}"/>
</i:InvokeCommandAction.CommandParameter>
</i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
The command binding works if it's bound to the viewmodel. But i would like to bind it to a behavior and i can't seem to find a way.
Make sure to add the reference to Behaviours SDK, and then you can do the following:
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped" SourceObject="{Binding ElementName="Control to trigger"}"> //Bind behaviour the the element you want to trigger
<Core:InvokeCommandAction Command="{Binding Command}" CommandParameter="{Binding parameter}"/> // Bind command and parameter to behaviour
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
Then you can switch between the EventNames in EventTriggerBehaviour to trigger the controls as you want.