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.
Just want to let you know that I was able to work out a solution. All I need to know is there a way not to let the context menu on DataRecordPresenter not hide the context menu on XamDataGrid?
I have been looking into your questions. About you first question I can suggest you create the same menu that is for DataRecordPresenter and for XamDataGrid. After moving the ComtextMenu for the DataRecordPresenter, to the XamDataGrid, you can change the binding for the Command and for the CommnadParameter you can bind to the ActiveDataItem, instead of the DataItem for the DataRecordPresenter I modified the sample that I have sent you previously, to show you how you can implement the functionality that you want to achieve.
I am not completely sure that I understand correctly your second and third requirement. Please can you provide me with more details about you requirements and would you please modified my sample and show me how exactly want look or sent me an isolated sample application.
Looking forward to hearing from you.
I am just checking your progress on the issue that you are having.
If you require any further assistance please do not hesitate to ask.