Monday, February 28, 2011

Context menu in Silverlight

Hi all.

Few months ago I was trying to find a standard way to implement a context menu, but could find no solution which I liked. So finally decided to write something from scratch.
I will not go down into the details here, just will give the idea here.
So first of all I thought, that the menu can contain several kind of items:
1. Items, which are system(application) wide, and you will have them in your entire application, anywhere you'd click. The "About" menu item appears under this case.
2. Items, which are based on the control type, which on the user clicks the right mouse button: these can be buttons, textboxes, anything derieved from Control. Into this point I have added the Cut, Copy, Paste items for textboxes.
3. Items, bound to exact controls - concrete instances. In this case, only when you click on the specified instances, the items should appear there in the menu.

The implementation is quite simple, so I will not include any code here. But if you'll need just write me, and I will be happy to help.

So, this is all.

No comments: