Click here to Skip to main content
15,937,012 members
Please Sign up or sign in to vote.
4.33/5 (3 votes)
See more:
I am using System.Windows.Interactivity.dll and Microsoft.Expression.Interaction.dll to do event handling in Viewmodel in my MVVM WPF project. below is the code inside my Xaml:
<ItemsControl ItemsSource="{Binding Path= HeaderList}" Grid.Row="0" Grid.Column="0" >
                 <TextBlock   Text="{Binding Text}" Width="100" HorizontalAlignment="Left" >
                         <i:EventTrigger EventName="PreviewMouseLeftButtonDown">
                            <ie:CallMethodAction MethodName="PrevMouseDownEventHandler" TargetObject="{Binding}" />

for this I added namespaces in the same Xaml.

and in my viewmodel I have created a method having PrevMouseDownEventHandler name which is same as that of I mentioned as CallMethod inside EventTigger in the Xaml.

On running my application when I presses mouse button on TextBlock event is generated and look for PrevMouseDownEventHandler method and leave me into following exception:

Could not find method named 'PrevMouseDownEventHandler' on object of type 'string' that matches the expected signature.

this method is as below in my ViewModel.
public void PrevMouseMoveEventHandler(object sender, MouseButtonEventArgs e)
        // Some implementation here;  

I don't have any idea where I am going wrong. Except this all the funtionalities inside Viewmodel is working fine for me. what would be possible solution for this?
Updated 25-Sep-12 22:09pm

1 solution

see here

WPF DrawTools[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900