Bound column in a ListView GridView
How to get the DataSource in a MouseDown event
try this...
private void NameCol_mousedown(object sender, MouseButtonEventArgs e)
{
var tb = (TextBlock)e.OriginalSource;
var dataCxtx = tb.DataContext;
var dataSource = (DocProp)dataCxtx;
}
For anyone still having problems, this works fine as well.
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
var baseobj = sender as FrameworkElement;
var myObject = baseobj.DataContext as (Object you expect);
// Example: var myObject = baseobj.DataContext as Dog;
// myObject.Bark();
}