Hi
How can two infragistics controls share the same context menu. Say, I have xamdatatree and xamdiagram in a window and I wanted to have same context menu for both controls?
Thanks.
Hello Abs,
I am glad to see that the recommendations I had given have resolved this issue for you.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Hi Andrew, thank you very much for your prompt response, I had moved XamContextMenu to resources section in MainWindow and user controls were not able to resolve this. However now I have moved these to application resources as you suggested and it works perfectly.
Thanks again.
I am rather unsure why you are receiving a NullReferenceException on this matter, but I would recommend in this case, to place the XamContextMenu in a spot where both of the elements within the UserControls can access the XamContextMenu via its key.
For example, if you keep the XamContextMenu in the Grid.Resources like in the original sample project I had sent you, then the XamDiagram and the XamDataTree won't be able to access it after being moved to their own separate UserControls. However, if you were to move the XamContextMenu to a section like your Application.Resources in your App.xaml file, both of these controls would be able to access the XamContextMenu again and you shouldn't see any sort of exceptions.
I have attached a modified version of the original sample project I had sent you to demonstrate the above.
Andrew one more question, how can this context menu be used in user controls of within same application. Lets say I have mainwindow which has two columns; each column is populated with user control. One user control (separate file) has XamDataTree and other has XamDiagram. When I reference as mentioned earlier it fails due to null reference exception
Thank you for your response. I am glad that the sample project works for you on this matter.