Skip to main content

Microsoft Silverlight

Answered Question Context MenuRSS Feed

(0)

Gourav K
Gourav K

Member

Member

1 points

3 Posts

Context Menu

How to make Context Menu in Silverlight...??

Right Click ..Context Menu like we get in .Net.
 


 

silverbyte
silverbyte

Participant

Participant

1338 points

405 Posts

Re: Context Menu

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.

Please click on 'Mark as answer' near my comment if you feel I answered your question.

Gourav K
Gourav K

Member

Member

1 points

3 Posts

Re: Re: Context Menu

Can you give me some example or sample code. so that it will be more understandable. 

TomBeeby
TomBeeby

Participant

Participant

1151 points

188 Posts

Re: Re: Context Menu

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?

Gourav K
Gourav K

Member

Member

1 points

3 Posts

Re: Re: Re: Context Menu

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 Wang - MSFT
Amanda W...

All-Star

All-Star

17241 points

1,466 Posts

Re: Re: Re: Context Menu

 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!

Amanda Wang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Brauliod
Brauliod

Participant

Participant

1169 points

472 Posts

Silverlight MVP

Re: Re: Re: Context Menu

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 :-)

// ---------------------------------
    Braulio Diez

    http://www.dbschemaeditor.com
    Free Silverlight Based Database Schema Editor
/// ---------------------------------

Amanda Wang - MSFT
Amanda W...

All-Star

All-Star

17241 points

1,466 Posts

Answered Question

Re: Re: Re: Context Menu

 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

Amanda Wang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities