Using the approach outlined at:
http://forums.infragistics.com/blogs/devin_rader/archive/2011/04/15/extending-xamgrid-with-a-right-click-context-menu.aspx
with 2011.1, there does seem to be a problem with this and your persistence framework. When I load the xamgridex from isolated storage, the context menu shows up ok, but the events don't work. If I don't use your persistence mechanism and just construct the xamgridex normally (i.e. don't call PersistenceManager.Load) the click events for the menu items of course work as expected.
Does anyone have any ideas on how to work around this and make events work when using persistence manager?
HI,
The persistence framework can't save everything:
http://help.infragistics.com/NetAdvantage/Silverlight/2011/1/CLR4.0/?page=Persistence_About_Infragistics_Control_Persistence_Framework.html
There are some types of properties that are not saved by the Infragistics Control Persistence Framework. It does not save AttachedProperties, DataTemplates, Paths, ControlTemplates, Styles, and ItemPanelTemplates. However, if you needed to save such properties, you can use the Identifierattached property off the PersistenceManager. Other types that the framework does not save are the Cursor, FontWeight, FontFamily and FontStyle. You can however save these by using a custom TypeConverter.
This actually also includes events. So if you're placing a Clicked event on the menu, and that menu is being restored through persistence, it will lose its events. As the menu would have been re-created and thus the events would not have been loaded on it.
You'd be better off, hooking up the event in code to the ContextMenu when it's set, and exposing the Click event off of the xamGrid.
-SteveZ
Thank you very much for this suggestion to expose the click event off of the xamGridEx - it was just a few lines and works like a champ even with persistence! FWIW, I'd vote for you including the context menu option in your stock grid - so no subclassing would be required but perhaps there is a reason you don't.
Thanks again!