Hi,
I am currently working with an UltraDockWorkspace containing DockableControlPane windows.I wanted to use the MouseEnterElement and MouseLeaveElement events to modify the system shortcut menu that appears on the window tab as shown in the attached image but these events are not triggered when I move with the mouse on the tab.Do you know the mouse events to use to hide items in the system menu that can be seen in the image?thank you in advance
Regards
Hi Mike,
Hi Pokorny,
Is there anything further that I can do to assist you? Please let me know.
It's good, I managed to do what I wanted with your indications.Thank you for your help.
Best regards
I'm working on a TabbedMDIManager control.I will explore the track of the InitializeContextMenu event.I'll keep you informed.Thank you very much for the advice.
The MouseEnterElement and MouseLeaveElement events are associated with the UltraDockWorkspace like this :
public void ultraDockManager_MouseEnterElement(object sender, UIElementEventArgs e) {if (e.Element is DockableWindowUIElement) { e.Element.Control.MouseDown += OnMouseDown; } }
public void ultraDockManager_MouseLeaveElement(object sender, UIElementEventArgs e) {if (e.Element is DockableWindowUIElement) { e.Element.Control.MouseDown -= OnMouseDown; } }
private void OnMouseDown(object sender, MouseEventArgs e) { if (_subscribedToMenuPopup == false) { var contextMenu = ((Control)sender).ContextMenu; contextMenu.Popup += ContextMenu_Popup; _subscribedToMenuPopup = true; } }
private void ContextMenu_Popup(object sender, EventArgs e) { var igContextMenu = (Win.IGControls.IGContextMenu)sender; var hideItem = igContextMenu.MenuItems.OfType<MenuItem>().FirstOrDefault(i => i.Text.Contains("Masquer") || i.Text.Contains("Hide")); if (hideItem != null) igContextMenu.MenuItems.Remove(hideItem); }
But when I move my mouse directly on the tab, the MouseEnterElement event is not triggered.If I move my mouse directly on the window under the tab, the MouseEnterElement event is triggered.
Here is the code that displays the window :
[CommandHandler(CommandNames.ShowResourcesSearchForm)] public void ShowResourcesSearchForm(object sender, EventArgs e) { ResourcesSearchView view = null; if (WorkItem.SmartParts.Contains(_ViewId)) view = WorkItem.SmartParts.Get<ResourcesSearchView>(_ViewId); else view = WorkItem.SmartParts.AddNew<ResourcesSearchView>(_ViewId);
Domain currentDomain = WorkItem.RootWorkItem.State[BDoc.Infrastructure.Interface.Constants.StateNames.CurrentDomain] as Domain; if (currentDomain != null) view.InitialDomain = currentDomain;
// Bug 2800 : View is flickering when showing as screen centered - floating view // As a work around, we are not using the habitual way for showing view , // we manually create the DockableControlPane that will host the view
UltraDockWorkspace dockWorksapace = this.WorkItem.Workspaces[BDoc.Infrastructure.Interface.Constants.WorkspaceNames.DockWorkspace] as UltraDockWorkspace; if (dockWorksapace == null) return;
DockableControlPane dockableControlPane = dockWorksapace.PaneFromControl(view); if (dockableControlPane != null) { dockableControlPane.Show(); dockableControlPane.Activate(); } else { Size viewSize = new Size(895, 620); dockableControlPane = new DockableControlPane(); dockableControlPane.Text = Module.ResourceManagerService.GetString("bdoc_ui_utils_resources_search_view_title"); dockableControlPane.Settings.Appearance.Image = Module.ResourceManagerService.GetBitmap("search_16px"); dockableControlPane.Control = view; dockableControlPane.Settings.AllowClose = Infragistics.Win.DefaultableBoolean.True; DockAreaPane dockAreaPane = new DockAreaPane(DockedLocation.DockedRight); dockAreaPane.Size = viewSize; dockAreaPane.Panes.Add(dockableControlPane); dockWorksapace.DockAreas.Add(dockAreaPane); dockableControlPane.IsMdiChild = true;
dockWorksapace.BeforePaneButtonClick += dockWorksapace_BeforePaneButtonClick; }
That do you think about it ?