Well the question says it all? I have a DataTemplate with a button is there any way to run a function or some how tell the object that the button was pressed?
From stackoverflow
-
Give the button a x:name and you can see that name in the button events 'sender' or e.source parameter
var source = sender as FrameworkElement; // Or whatever real control it is var parent = source.parent; // Get parent control(s) var dataContext = source.DataContext; // Get databinding contextPetoj : Ok so far so good but that did not solve my problem :P, i get to .net code but how do i get the Object that the datatemplate is for? in my case JobPetoj : nvm button.DataContext solved it! thank you
0 comments:
Post a Comment