Question : WPF: Adding Context Menu to Dynamically Create Labels

Hello,

I'm working on a WPF application that dynamically generated labels on the screen.  But I need to be able to add a context menu.   I've seen some sites that say how to create one, but it needs to be assigned to a specific control.

Is there a way that I can have the context menu for each control (obviously one at a time hehe)?

Answer : WPF: Adding Context Menu to Dynamically Create Labels

Once you create a context menu object, all it takes to associate it to a control is to set the context menu object to this control's ContextMenu proprety. Same applies to your dynamic labels.
http://msdn.microsoft.com/en-us/library/system.windows.controls.contextmenu(VS.85).aspx
Random Solutions  
 
programming4us programming4us