Note that there are some explanatory texts on larger screens.

plurals
  1. POBuilding a EventTriggerBehavior that supports my own customized events
    text
    copied!<p>I built my own UserControl (that I consume from a separate assembly) with its own customized events, in the parent project I want to use those events with <strong>Commands</strong> since it's an <strong>MVVM</strong> application, all by using the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/dn457340.aspx" rel="nofollow">Behaviors SDK (XAML) for Visual Studio 2013</a>, as follows :</p> <pre><code>&lt;mediaPlayerControl:PlayerControl&gt; &lt;interactivity:Interaction.Behaviors&gt; &lt;core:EventTriggerBehavior EventName="ForwardClicked"&gt; &lt;core:InvokeCommandAction Command="{Binding OnForwardClicked, Mode=TwoWay}"/&gt; &lt;/core:EventTriggerBehavior&gt; &lt;/interactivity:Interaction.Behaviors&gt; &lt;/mediaPlayerControl:PlayerControl&gt; </code></pre> <p>The problem is that the EventTriggerBehavior supports only some specific events as mentioned <a href="http://msdn.microsoft.com/en-us/library/windows/apps/dn469361.aspx" rel="nofollow">here</a>, hence the commands I'm using on my events don't fire, now, what I want to do is, to build behaviors that provide the same experience, and that support my own event: I want them to look similar to this :</p> <pre><code>&lt;mediaPlayerControl:PlayerControl&gt; &lt;interactivity:Interaction.Behaviors&gt; &lt;core:ExtensionsEventTriggerBehavior EventName="ForwardClicked"&gt; &lt;core:ExtensionsInvokeCommandAction Command="{Binding OnForwardClicked, Mode=TwoWay}"/&gt; &lt;/core:EventTriggerBehavior&gt; &lt;/interactivity:Interaction.Behaviors&gt; &lt;/mediaPlayerControl:PlayerControl&gt; </code></pre> <p>I've read many articles about implementing such behaviors, but I couldn't get it clear for me since it's the first time I deal with them this way, I would like if you show me how to do.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload