Hi,
I have a context menu on my xamdatagrid. When I select the menu option, I want to be able to open a popup window with some input fields. I want to be able to read the fields entered by the user in the popup window and do some changes to the data in the xamdatagrid. How do I go about this?
Thank you
Hello Lalasa,
Thank you for your post.
I have been looking into your issue and I can suggest you create a ContextMenu for DataRecordPreseter instead of XamDataGrid. You can create a command for the MenuItem of ContextMenu and as Command Parameter you can set the DataItem of current record where is the cursor of the mouse. I created a sample application based on your scenario to show you how you can implement the functionality that you want achieve. In the sample I created a command that get the data that current row contains and show the Dialog window.
Please let me know if you need any further assistance on this matter.
Thank you. This is a very good solution but I am having a few issues using this. I have not been very clear on what I want to achieve.
1. The context menu on the DataRecordPresenter is hiding the contextmenu I already have on XamDataGrid. So I am loosing the context menu on the xamdatagrid. So, I would rather have the menu item on the XamDataGrid and the menu action performed on the selected item unless there is a workaround.
2. In my case, the popup window will not display the same information as the selected record. It has options for the user to select - if it should create and attach the information in the selected record as a child to an existing record (identify using id) of a hierarchical xamdatagrid on a different tab or if it should create a new parent record and then attach a record with the information in the selected record to this parent record and then add it to the hierarchical xamdatagrid on a different tab. This means, I need MainWindow to have access to the information selected in the Popup Window somehow so that the MainWindow can update the hierarchical xamdatagrid on the other tab with the selected information. All the tabs and xamdatagrids on the tabs are created in the MainWindow.
3. On Clicking the Edit button, I have to update the hierarchical xamdatagrid on a different tab based on the option selected in item 2.