I would like to disable few context menu from ContentPane header & Pinned TabGroupPane. How do I go about with this?
Pinned ContentPane Hide Menu
Header context Menu
Hide/Disable New Horizontal Tab Group & New Vertical Tab Group menu
I have been investigating into your requirement in this case, and from the screenshots you have provided, my impression of what you are looking to achieve is that you wish to only allow Dockable, Tabbed Document, and Auto Hide menu items for your ContentPanes that are not in the DocumentContentHost. In the DocumentContentHost, you wish to do the above, as well as hiding the New Horizontal Tab Group and New Vertical Tab Group options. If this is not the case and my impression is incorrect in any way, please let me know, as the following is based on this impression.
You can do this by using a Style for ContentPane, setting AllowFloatingOnly and AllowClose to “false.” This will achieve your first two requirements.
In order to achieve the removal of the “tab group” setting, I would recommend handling the ContentPane.OptionsMenuOpening event. The event arguments of this event will net you the menu items, and if you check the ContentPane.PaneLocation for Document first and call e.Items.RemoveAt(e.Items.Count – 1) three times (where ‘e’ is the event arguments) you can achieve your requirement.
I am attaching a sample project to demonstrate the above. I hope this helps you.
Please let me know if you have any other questions or concerns on this matter.
Andrew, Thanks for a quick response. The issue using OptionsMenuOpening is resolved. However I still see the drop down arrow with AllowFloatingOnly & AllowClose set to false.
I apologize, I was under the impression that you were just looking to remove menu items from the “arrow” drop-down menu, not remove that menu entirely.
To remove it entirely, you can add a Setter to the Style for the ContentPane that targets the “WindowPositionMenuVisibility” property, setting it to “Collapsed” like so:
<Setter Property="WindowPositionMenuVisibility" Value="Collapsed"/>