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:
- Install Blend Preview for SL5 from here
- Reference
System.Windows.Interactivity
andMicrosoft.Expression.Interactions
in your Silverlight project - Define the correct namespace in XAML:
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"