I wanted to bind an event with ViewModel.
I used
clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity
and i used trigger for the same
  <Canvas Grid.Row="2" Grid.Column="2" x:Name="InteractiveCanvas" Style="{StaticResource canvasChartStyle}" ClipToBounds="True" >
        <intr:Interaction.Triggers>
            <intr:EventTrigger EventName="MouseEnter">
                <intr:InvokeCommandAction Command="AppointmentEditing" />
            </intr:EventTrigger>
        </intr:Interaction.Triggers>
    </Canvas>
but I need event arguments to be used. Here am not able to get the same.
In wpf any possiblity is there to bind event and get event arguments ? With out ussing MVVM lite or PRISM.
I just want to get the event arguments
You can do it by adding the DLL's:
System.Windows.InteractivitiyMicrosoft.Expression.InteractionsIn your XAML:
Use the CallMethodAction class.
Use the EventName to call the event you want; then specify your Method name in the MethodName.
<Window>
    xmlns:wi="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions">
    <wi:Interaction.Triggers>
        <wi:EventTrigger EventName="SelectionChanged">
            <ei:CallMethodAction
                TargetObject="{Binding}"
                MethodName="ShowCustomer"/>
        </wi:EventTrigger>
    </wi:Interaction.Triggers>
</Window>
In your ViewModel Code:
public void ShowCustomer()
//The method must be public & can take 0 parameters or 2 parameters i.e.
//object sender & EventArgs args
{
    // Do something.
}
P.S: This is a real late response to the question but I hope it helps you.
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