You should be able to grab the data context from sender without iterating the 
visual tree at all. Data contexts flow down automatically. 



Cheers,

Jordan. 

On 06/12/2011, at 11:03 PM, "Greg Keogh" <g...@mira.net> wrote:

> 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
_______________________________________________
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to