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}" />
Hi Finally i found the solution for it..
i include the below in the XAML page:
then the code for combobox is:
Here Employees is like a datasource to get all the employee in Observable Collections.
that code be written in Employee.cs file.
then we access the ComboboxSelected event as follow..
Goto ViewModel Folder and Wrote the function named as follows,
Happy Coding…!