The Property 'Command' was not found in the 'InvokeCommandAction' type for combobox

advertisements

I have a combobox in silverlight mvvm. i need to wrote the event for combobox name 'SelectionChanged'. i Create the coding below but it gives an error.. "The Property 'Command' was not found in type 'InvokeCommandAction' "

Note: I am not using Silverlight Light. I'm using Silverlight5 and its a silverlight application.

<ComboBox x:Name="myComboBox" Width="150" ItemsSource="{Binding Items}" >
                                    <ComboBox.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel>
                                                <TextBlock Text="{Binding Name}"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </ComboBox.ItemTemplate>
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="SelectionChanged">
                                            <i:InvokeCommandAction Command="{Binding LoadCommand}" CommandParameter="{Binding SelectedItem, ElementName=myComboBox}" />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                </ComboBox>

this line the error comes.

<i:InvokeCommandAction Command="{Binding LoadCommand}" CommandParameter="{Binding SelectedItem, ElementName=myComboBox}" />


Seems to be working for me. Make sure that you:

  1. Install Blend Preview for SL5 from here
  2. Reference System.Windows.Interactivity and Microsoft.Expression.Interactions in your Silverlight project
  3. Define the correct namespace in XAML: xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"