Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
135
Tools Dynamically added to Context menu are not visible.
posted

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?

Parents Reply Children
No Data