Answer the question
In order to leave comments, you need to log in
How to handle an event within MVVM via Interactions.Triggers in a linked library?
Hello.
And so, what's the problem.
I can handle the event via Interaction.Triggers like this
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
<i:Interaction.Triggers>
<i:EventTrigger EventName="Drop">
<ei:CallMethodAction
MethodName="DropFilesToCollection"
TargetObject="{Binding}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
public void DropFilesToCollection(object sender, DragEventArgs e)
{
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
OpenFileMaster.Add(files);
}
xmlns:gif="http://wpfanimatedgif.codeplex.com"
gif:ImageBehavior.AnimationCompleted=""
<i:Interaction.Triggers>
<i:EventTrigger EventName="gif:ImageBehavior.AnimationCompleted">
<ei:CallMethodAction
MethodName="Image_AnimationCompleted"
TargetObject="{Binding}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
Answer the question
In order to leave comments, you need to log in
Write your own trigger to account for attached events. As, for example, done here:
https://sergecalderara.wordpress.com/2012/08/23/ho...
or here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question