C#: Listbox Contextmenu for Listboxitems (WPF)?

I would set the ContextMenu in the ListBoxItem 's style, rather than in the DataTemplate.

Up vote 2 down vote favorite share g+ share fb share tw.

I want for my Listbox in WPF a contextmenu. I did it with a contextmenu for the whole listbox, but you can richt-click to get the contextmenu even if you don't click on a item. I found something at google, but this didn't work out.

I tried something like this: I tried it with a textblock like in the example, with other elements like in other tutorials, I tired it without and many other things- but nothing worked. No contextmenu for my listbox items :( later I tried something like this: But it didn't work too. Can someone give me a hint/working example :)?

Thank you c# wpf listbox contextmenu listboxitem link|improve this question edited Dec 12 '10 at 0:11Meleak23.2k41861 asked Dec 11 '10 at 19:52user437899219213 86% accept rate.

I would set the ContextMenu in the ListBoxItem's style, rather than in the DataTemplate.

Thank you all :) – user437899 Dec 12 '10 at 1:52.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions