Hi,
how do I disable the behaviour that the ribbon collapse on double click on ribbon tabs?
Found some forum entries which are at least 4 years old telling that it is not possible and one should request this as feature.
I guess those people did. So, how to disable it?
Regards
Michael
Hello Michael,
It does appear that the sample project failed to attach here. I am attaching it below, although from the code you have provided, you essentially have what I put together. I don't think MouseEnterElement and MouseLeaveElement would be better here, as this would potentially disable the highlighting effects of when you mouse over a particular tab.
Please let me know if you have any other questions or concerns on this matter.
ToolbarManagerDisableDoubleClick.zip
In the meantime I may have found a solution myself:
Can I handle it this way ?
Would it be more efficient to add a filter in MouseEnterElement and remove it in MouseLeaveElement?
public bool PreFilterMessage( ref Message m ) { const int WM_LBUTTONDBLCLK = 515; if (m.Msg == WM_LBUTTONDBLCLK) { Console.WriteLine("Left Mouse double click"); Point screenPoint = Cursor.Position; RibbonTab tab = _mgr.RibbonTabFromPoint(screenPoint); UIElement uiElem = _mgr.UIElementFromPoint(screenPoint); if (uiElem?.Parent is RibbonTabItemUIElement) { Console.WriteLine($"Mouse inside of {tab.Caption}"); return true; } } return false; // Not Handled }
Hi Andrew,
thanks for your help.
Did you probably forget to attach the example? :-)
I have also found forum entries that are rather old that suggest that a user suggests a product idea for this feature, but when looking through our suggested features, I cannot seem to find one that matches this. As such, nothing has been implemented for this at the moment, and if you would like to see it implemented, I would recommend suggesting this feature at our Windows Forms ideas site.
As this behavior does seem to have been requested on the forums quite a bit, I’d like to offer a workaround in this case. I would recommend utilization of an IMessageFilter to catch the Mouse left button double-click if it is over an UltraToolbarsDockArea and mark it handled if so. This will prevent the internal MouseDoubleClick code from going through, and effectively prevent the ribbon from collapsing on double-click.
I am attaching a sample project to demonstrate this. I hope it helps you.