I’m just beginning with Silverlight. I have a DataGrid whose ItemsSource is linked to an ObservableCollection. Each row of the DataGrid (AutoGenerateColumns= “False”) has some values from an object and a button. How can I associate a “command argument” to the button so that I know what button of what row is being clicked?
Thanks
You can use Tag attrribute for that. Assuming that the objects in the collection have “Id” property you can bind the “Tag” attribute of the button control to the Id of the object with:
or you can store the entire object in Tag
Then in click handler you have to use the sender parameter to get the sender control and extract the tag info: