If you are using MVVM, then you can bind your button to a command on the object 
being bound to.


From: ozsilverlight-boun...@ozsilverlight.com 
[mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of Greg Keogh
Sent: Tuesday, 6 December 2011 8:04 PM
To: 'ozSilverlight'
Subject: DataGrid row button click

Folks, I think I've outsmarted myself. I have a DataGrid bound with a template 
column containing a Button and it's all looking quite acceptable. Now I'm a bit 
flummoxed, as when one of the buttons is clicked I have to find out which 
object in the data source is behind the row containing the button.

Unlike the WinForms grid, I have no RowIndex or similar property to help me, 
all I have are two properties on the Click event: sender and e.OriginalSource, 
which seem to be the same.

I'll probably have to walk backwards up the control tree somehow to find the 
row and the item it's bound to, but I don't know how yet. Has anyone done this 
and got clues? I'll keep web searching in the meantime.

Greg
_______________________________________________
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to