Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you bind a whole object to a CommandParameter in XAML?

I have a linkbutton inside a listbox that receives a list of objects. I'm using the ListBox.ItemTemplate and DataTemplate to lay out the listbox items. Can I bind the entire object that is currently binding to the command parameter of the linkbutton? I've tried using

CommandParameter={Binding Data}

and

CommandParameter={Binding DataItem}

but I always get the error in output that 'Data' or 'DataItem' is not a property on said object. Is this even possible?

like image 445
Josh Avatar asked Oct 04 '10 16:10

Josh


1 Answers

Try this

CommandParameter = {Binding}

It will bind to the current object which used to generate the item

like image 54
TalentTuner Avatar answered Oct 20 '22 21:10

TalentTuner