IInitializeContextMenu event for UltraTabbedMdiManager is documented for net 4 version in Infragistics help:
InitializeContextMenu Event - Infragistics Windows Forms HelpBut the API for net 7 version is different. Instead of Infragistics-specific IGMenuItem controls standard ToolStripItem classes are used. And when I try to use them I get working menu items but without text or images. Basically empty lines in a menu.Before I blame Infragistics for this it would be nice to look at some "official" net 7 example. Could be I'm doing something wrong. Is there such an example somewhere?
Hello,
Thank you for contacting Infragistics. Please attach a complete sample demonstrating the issue.
HelloActually it was I who was asking for a working sample :-) Because looks like the standard documentation doesn't have it. It is about net 4. But net 7 version will be more and more requested.This is not (yet) an issue report, because could be I'm doing something wrong (need an example).Providing the whole sample from me would be difficult because it is a complex commercial software requiring a server part to be running.But the task is pretty simple. I have UltraTabbedMdiManager there and in addition to the standard context menu I'd like to insert a couple of convenience menu items: "Close All" and "Close All but this". This worked in net 4 version.Here how it looks in net 7:
private void m_UltraTabbedMdiManager_InitializeContextMenu( object sender, MdiTabContextMenuEventArgs e ) { if ( e.ContextMenuType != MdiTabContextMenu.Default ) return; // Find the position of the 'Close' menu item int idxClose = -1; for ( int i = 0; i < e.ContextMenu.Items.Count; i++ ) { if ( StringComparer.OrdinalIgnoreCase.Compare( e.ContextMenu.Items[i].Text, m_ResourceService.GetString( ResourceIds.Presentation_WinForms_Close ) ) == 0 ) { idxClose = i; break; } } if ( idxClose == -1 ) return; ToolStripItem menuItemCloseAllButThis = new ToolStripButton( "Close all but this" ); menuItemCloseAllButThis.Click += ( sndr, eargs ) => { MdiTab mdiTabNotToClose = ( sndr as ToolStripItem ).Tag as MdiTab; foreach ( MdiTab mdiTab in GetAllMdiTabs( m_UltraTabbedMdiManager ) ) { if ( mdiTab != mdiTabNotToClose ) mdiTab.Close(); } } ); menuItemCloseAllButThis.Tag = e.Tab; ToolStripItem menuItemCloseAll = new ToolStripButton( "Close all" ); menuItemCloseAll.Click += ( sndr, eargs ) => { foreach ( MdiTab mdiTab in GetAllMdiTabs( m_UltraTabbedMdiManager ) ) mdiTab.Close(); } ); e.ContextMenu.Items.Insert( idxClose + 1, menuItemCloseAll ); e.ContextMenu.Items.Insert( idxClose + 1, new ToolStripSeparator() ); e.ContextMenu.Items.Insert( idxClose + 1, menuItemCloseAllButThis ); e.ContextMenu.Opening += ( sndr, eargs ) => { ContextMenuStrip contextMenu = sndr as ContextMenuStrip; if ( contextMenu.Items.Count > idxClose + 1 ) { contextMenu.Items[idxClose + 1].Enabled = GetAllMdiTabs( m_UltraTabbedMdiManager ).Count > 1; } }; }
The difference with net 4 version is that I insert ToolStripButton instead of IGMenuItem.And here is the menu I get:
Note that a tooltip is correct, but no menu text is shown, the menu item is just empty.