Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Context Menu
7 replies. Latest Post by Amanda Wang - MSFT on December 2, 2008.
(0)
Gourav K
Member
1 points
3 Posts
11-26-2008 9:55 AM |
How to make Context Menu in Silverlight...??
Right Click ..Context Menu like we get in .Net.
silverbyte
Participant
1338 points
405 Posts
11-26-2008 10:00 AM |
I need the same thing and I will implement it tomorrow using a ListBox and a hidden Popup to catch the click outside the ListBox.
There is no Menu or ContextMenu in Silverlight.
11-27-2008 12:06 AM |
Can you give me some example or sample code. so that it will be more understandable.
TomBeeby
1151 points
188 Posts
11-27-2008 11:54 PM |
I have though about this very much, and come up with what i consider an adequate solution (for now)
let me prefix this by saying... i don't want to consider overlaying html DIVs with javascript as this sounds like a nightmare to me (though i hear it can be done!)
i have extended a Button control to fire a 'Long Click' event. 600 milliseconds works pretty good. when a user clicks the button and holds the left mouse button down, after the duration has elapsed i open a Popup control with top left positioned at the mouse. anything (e.g. buttons, hyperlinks, etc) can be put in the popup.
Currently i use this on a TreeView, so that users can click-hold on a treeview item and get a context menu that varies depending on the item.
it ends up being quite intuitive and user friendly...
i am more than happy to share the code, though it doesn't lend itself to being pasted in a forum. i'll provide a link if there is interest.
as a question to the Silverlight People... Flash 10 allows developers to add items to the rightclick context menu... when can we have this in Silverlight?
11-28-2008 5:17 AM |
Thanks Tom
I need context menu on my treeview only , it will be great if you can give me link for the sample code And one more thing i want to discuss is
How to get TreeView Events like we have in .Net Like :- BeforeCollapsed, AfterCollapsed and NodeMouseClick
Amanda W...
All-Star
17241 points
1,466 Posts
11-29-2008 5:30 AM |
Hi Gourav ,
Gourav K:How to get TreeView Events like we have in .Net Like :- BeforeCollapsed, AfterCollapsed and NodeMouseClick
If you have any feature requests, you can post them to the Issue Tracker,, which can help us to shape the Silverlight Toolkit with your feedback!
Brauliod
1169 points
472 Posts
11-30-2008 7:59 AM |
A colleague has implemented a contextual menu, but instead of clicking right click, the user will have to use the combination of key CTRL + Right Click (I guess in flash they made the same trick).
About the sample, sorry it's in spanish, but you can take a look to the sourcecode.
http://www.albloguera.es/?p=29
If you want the sample in english just write a note to this guy, let's promote his job :-)
12-02-2008 5:01 AM |
Hi,
Try to refer this link to handle the right click in silverlgiht. http://blogs.microsoft.co.il/blogs/alex_golesh/archive/2008/02/07/how-to-handle-rightclick-mouse-event-in-silverlight.aspx