tags:

views:

14

answers:

1

Hi,

I have a contextmenu in which i binded some items as menuitem at runtime. I have subscribed an click event also.

Now how to find wwhich item was cliked from the binded item in the event?

Thanks,

A: 

This is merely speculation, but in WPF, there are two main ways. First one is to check the 'SelectedItem' property from your object if it has one.

The other one is to chech the arguments that are passed to the event. If your event have a RoutedEventArgs, this variable will contains a property called 'Source' which should contains the object that called the event. This could be used for example, when you have a button inside a listview item templa te and you want to know which one was clicked

David Brunelle