I am attempting to migrate from Infragistics v7,3 to v16.2.
So far this has been mostly painless, however for some reason the existing code which dynamically changes the context menu based on data that is present in the row you are right clicking on, is no longer working as expected.
I have verified that our 'mergeMenus' method is in fact adding the 'sourceMenu' items to the 'targetMenu':
public static void MergeMenus(PopupMenuTool targetMenu, PopupMenuTool sourceMenu) { if (targetMenu != null && sourceMenu != null) { //Add source tools into target menu... int count = 0; ToolBase addedTool; foreach (ToolBase tool in sourceMenu.Tools) { if ( !targetMenu.Tools.Exists(tool.Key) ) { addedTool = targetMenu.Tools.AddTool(tool.Key); addedTool.InstanceProps.IsFirstInGroup = tool.InstanceProps.IsFirstInGroup; count++; } } //Group merged source items... if (count > 0) targetMenu.Tools[targetMenu.Tools.Count - count].InstanceProps.IsFirstInGroup = true; } }
All the tools are present in the targetMenu (though they are not visible on screen) and have all properties set exactly the same as those tools who are visible except:
AttachedParentTool is null and UIElement is null. Unfortunately these are read only properties and I cannot find any documentation on how these values should be properly initialized. I'm not even sure if this is causing the problem or not. Am I missing something?
So to make it even simpler, I tried adding a dummy ButtonTool like this:
var newTool = new ButtonTool("FunkyChicken") { SharedProps = { Caption = "TEST", Category = "InvalidWithNoReport", ToolTipText = "TESTING..." }, InstanceProps = { IsFirstInGroup = true } }; ContextMenuBase.ToolbarsManager.Tools.Add(newTool); ContextMenuBase.Tools.AddTool("FunkyChicken");
Unfortunately, this new tool does not show up either.
Hello Filip,
Thank you for contacting Infragistics!
The best way for us to assist you is if you provide a small isolated sample that we can run and use for debugging locally.