I'm building a program with MVVM pattern I can handle selectionchanged event with method in xaml.cs file in non-MVVM way. but don't know how to do this in MVVM.
Currently all my ICommand properties are in viewmodel.cs file, and view code like below
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="10,0" HorizontalAlignment="Right">
<Label Content="Ports" Margin="2" />
<ComboBox IsReadOnly="True" AllowDrop="True" x:Name="ComboBox_SerialPort" MinWidth="60" Margin="5"
ItemsSource="{Binding SerialPortList}" SelectedValue="{Binding SelectedSerialPort}"
SelectionChanged="{Binding Cmd_ComboBox_SerialDropDownSelectionChanged}" >
</ComboBox>
</StackPanel>
Apparently directly binding ICommand property to SelectionChanged is not working. but there's no Command property in Combobox control. So how do I attach ICommand to control events
Thanks