How to pass listbox selecteditem as command parameter in a button? How to pass listbox selecteditem as command parameter in a button? wpf wpf

How to pass listbox selecteditem as command parameter in a button?


Try this:

  1. Name your listbox
  2. Update the CommandParameter to:

    CommandParameter="{Binding ElementName=listBox1,Path=SelectedItem}"