Basically i have an Event in my custom class. I will call the particular method in the custom class with the event's argument -> properties as a parameter for that method.
You can observe the actual code behind information for this.
instance.FileOpening += (sender, e) =>
{
CustomClass.Method(e.XXproperty, e.YYproperty);
};
But i want to achieve this through interaction.Triggers in MVVM. So i used the following code in xaml.
<i:Interaction.Triggers>
<i:EventTrigger EventName="FileOpening">
<i:FileOpeningAction TargetObject="{Binding ElementName=cntrol}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
My corresponding TargetedTriggerAction class is here to get my customclass to execute the method.
public class FileOpeningAction :TargetedTriggerAction<CustomClass>
{
protected override void Invoke(object parameter)
{
((instance).TargetObject).Method(?,?);
}
}
But my question is How can i pass the e.XXproperty and e.YYproperty in the above action to execute the method in my custom class ?
You can try to use also interactivity library, then you can write this :
<i:EventTrigger EventName="FileOpening">
<ei:CallMethodAction TargetObject="{Binding}" MethodName="OnFileOpening"/>
</i:EventTrigger>
And in you code it will be something like
public void OnFileOpening(object sender, EventArgs e){//your code}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With