Max Zhukov
Max Zhukov

Reputation: 897

ContextMenu in Windows Phone 7

How to create several MenuItems and add it to ContextMenu in windows phone 7 with C#?

I wrote this sample:

MenuItem q = new MenuItem();
q.Header = "something";
ContextMenu cM = new ContextMenu(q);

and in MSDN there's something about it, but it doesn't compile, because of construct of ContextMenu.

Upvotes: 0

Views: 1431

Answers (2)

Praetorian
Praetorian

Reputation: 109139

You can add menu items as follows:

ContextMenu cm = new ContextMenu();

cm.Items.Add( new MenuItem() {
  Header = "Item 1",
} );

Upvotes: 1

Robaticus
Robaticus

Reputation: 23157

The ContextMenu isn't part of Wp7 natively. You need to look at the Silverlight Toolkit for WP7.

http://silverlight.codeplex.com/

Upvotes: 1

Related Questions