There is a Silverlight UserControl which got an MouseLeftButtonUp event. In xaml I add two triggers for this event. In which order Silverlight xaml-parser will parse and attach those triggers and can I be sure that trigger above will invoke first?

...
    <i:Interaction.Triggers>
      <i:EventTrigger EventName="MouseLeftButtonUp">
         <i:InvokeCommandAction Command="{StaticResource someCommand}"/>
         <AttachedBehaviors:SomeBehavior Parameter="Apple"/>
      </i:EventTrigger>
    </i:Interaction.Triggers>
...


UPDATE: Found connected issue In WPF, does the order of Triggers matter? which says:

WPF is processing triggers in declared order.

Hope, Silverlight behave exactly that same.

有帮助吗?

解决方案

Even if the order is defined I wouldn't do this. Add the order you want to the handler of the command.

void someCommand_Executed()
{
    DoFirstThing();
    DoSecondThing();
}

This kind of code will cause pain in the long run because the order is not easily enforced and you are creating a dependency between two methods.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top