Hello ,
I want to add menu items to context menu. After right click on any row of xamdatagrid, depending on data present in that row,I want to poppup a context menu. And after clicking on context menu item, I want to perform certain operations on xamdatagrid data. I have searched on forum but ,unable to find what exactly I have to do..?Can you please give me any idea..?
Thanking you.
Hello,
I am declaring menu items System.Window.Forms.ToolStripMenuItem in designer.I have declared its ".Text" property. I can add menu items to context menu. At run time it only occupy blank space in context menu. Headers are not visible in context menu. And also I have to handle click event on that menu item.
Thank you.
1) It depends on what your code. You can use a short syntax like :
ContextMenu c = new ContextMenu();
MenuItem itemName = new MenuItem() { Header = sendersName };
itemName.Click += delegate { MessageBox.Show("Clicked"); };
c.Items.Add(itemName);
or:
...
itemName.Click +=new RoutedEventHandler(itemName_Click);
I have gone through attachment, it helped me lot.
1) In attachment sample you have used system.windows.controls.MenuItem to add it into context menu.How to handle click event on that menu item.
2)for ToolStripMenuItem ,I can add menu item to context menu.Also I have set its text property in designer but I am unable to view any text(Header) in context menu at run time.Also unable to handle click event on it.
Thanks.
Thank you for your quick reply. I am writing first step code in constructor.
1)What is DRPContext..?
2)I can acess MouseRightButtonDown of xamDataGrid, but unable to access DataRecordPresenter itself.
I am writing code in vb.net.
Have you by any chance looked at this approach? Let me know if that is helpful and if you have questions on it.