0

I am using Visual Studio 2010 SP1. I've met a lot of articles where describes code of event handling(see below). For example this and this one.

I've added an assembly System.Windows.Interactivity. I am using ICommand interface to handle Commands. However, when I write a property "Command" in the line:

   <i:InvokeCommandAction Command="{Binding SelectionChangedCommand}"/>

I catch an error: Property "Command" does not exist in namespace XML "clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"..

<ListBox ItemsSource="{Binding SomeData}" Grid.Row="2" Margin="10" Background="LightGreen">            
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseEnter">
                    <i:InvokeCommandAction CommandName="{Binding SelectionChangedCommand}" CommandParameter="{Binding YourCommandParameter}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>            
</ListBox>       

Thus I have two questions:

  1. Where can I get a property Command? Or what should I write instead of it? I've tried to write CommandName but I've caught an error.

  2. What should I write to CommandParameter property? What type of a property should I create in a viewmodel to bind it to CommandParameter?

Community
  • 1
  • 1
StepUp
  • 36,391
  • 15
  • 88
  • 148
  • Are you using any 3rd party framework? – Sandesh Apr 23 '14 at 10:16
  • You need to define a class which implements `ICommand` interface. You can check [this link](http://stackoverflow.com/questions/1468791/wpf-icommand-mvvm-implementation) which might help you understand `Command` – Sandesh Apr 23 '14 at 10:43
  • What is your i namespace? – Dmitry Apr 23 '14 at 10:45
  • @aks81 yeah, I am using ICommand. – StepUp Apr 23 '14 at 10:50
  • It's weired because it compiles and runs on my computer with no error and I don't even have a VM behind just copied your code. You have Blend SDK 4.0 installed? – Dmitry Apr 23 '14 at 10:55
  • Control Panel -> Installed programs -> searchif you have Microsoft Expression Blend SDK 4 – Dmitry Apr 23 '14 at 11:04
  • The only explanation I see is that you actually referenced the Blend SDK 3. I checked it and yep it don't have Command property in that version. – Dmitry Apr 23 '14 at 11:08
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/51262/discussion-between-stepup-and-didier) – StepUp Apr 23 '14 at 11:36

1 Answers1

1

As we talked in the WPF chat room, take a look in the following question, it is quite similar to your problem.

Properties does not exist : System.Windows.Interactivity?

Community
  • 1
  • 1
André Silva
  • 1,149
  • 9
  • 30