0

I want to be able to send my Command the current ComboBox value.

This is my ComboBox

<ComboBox ItemsSource="{Binding ConcurrentFilesList}"
          SelectedIndex="0">
          <i:Interaction.Triggers>
                  <i:EventTrigger EventName="SelectionChanged">
                                    <i:InvokeCommandAction Command="{Binding ConcurrentFilesValueChangedCommand}"
                                                           CommandParameter="ComboBox.SelectedValue"/>
          </i:EventTrigger>
                 </i:Interaction.Triggers>
</ComboBox>

This ItemSource ConcurrentFilesList is List of numbers.

CanExecute

public bool CanExecute(object parameter)
{
    int num = (int)parameter;
    return true;
}

But my Parameter is string

EDIT

My parameter is "ComboBox.SelectedIndex" and not a number.

falukky
  • 1,099
  • 2
  • 14
  • 34
  • I mean that my Parameter is "ComboBox.SelectedIndex" – falukky Feb 02 '19 at 10:33
  • Instead of the string `ComboBox.SelectedValue` you probably want to assign a Binding to the CommandParameter property. See the answer to the duplicate question. – Clemens Feb 02 '19 at 12:25

0 Answers0