I have a ComboBox control inside Context menu for some Label Control that I have added in Code behind in wpf application. There are many Labels on the page that have Contextmenu. Basically it is like this LABEL contains ContextMenu and ContextMenu conntains Combobox. On Combobox’s SelectionChanged event I want to know which label’s contextmenu’s Combobox has generated this event?
Share
You can get the ComboBox from the
senderargument in the eventhandler.You can then get the ContextMenu from the
Parentproperty on the ComboBox.And then finally the Label from the
PlacementTargetproperty on the ContextMenu.