[Version 2.0] Hide Context Menu (Triangle)

Aug 10, 2012 at 3:58 PM

I have disabled every thing in the context menu for my Anchorable except "Dock as Tabbed Document".

I would like to disable that as well, but I don't see an option to do it.

However, I am wondering if there is a way to just get rid of the triangle menu altogether?

(I am using the MVVM selectors)

Aug 10, 2012 at 4:15 PM
Edited Aug 10, 2012 at 4:31 PM

There is a DockAsDocumentCommand.  Setting that to have its CanExecute to false disables it.

Similarly there is a ContextMenu property, but it does not seem to control anything. (I tried setting visiblity to hidden in both the setter and the getter and it did not hide the triangle.)


Aug 14, 2012 at 8:16 PM

Bump in hopes of a reply on how to hide the triangle menu.

Sep 11, 2012 at 9:33 PM

I'd like to know this too...

Jan 24, 2013 at 2:46 PM


It would be nice to have the option to remove the context menu.  Or to set it to null so it would remove triangle at the same time.

Jan 24, 2013 at 3:28 PM

There are a few ways to remove the context menu and the triangle.

First easy way to remove the context menu is at the level of the DockingManager

        <avalonDock:DockingManager x:Name="dockManager"
                                   Grid.Row="1" AnchorableContextMenu="{x:Null}" DocumentContextMenu="{x:Null}">

or in you override style as is :

        <Style TargetType="{x:Type avalonDock:DockingManager}">
            <Setter Property="AnchorableContextMenu" Value="{x:Null}"/>
            <Setter Property="DocumentContextMenu" Value="{x:Null}"/>


or you override the full style to create your own style.  Take one of the basice style that come with the control and remove or add your own part of the existing style.


As for the triangle you can add a visibility to the avalonDockControls:DropDownButton style as is :

                                Style="{StaticResource {x:Static ToolBar.ToggleButtonStyleKey}}"

I would suggest not to do it this way because you cannot override it later unless you bind it to a property.

But this work fine.

Jan 24, 2013 at 3:59 PM

The best way to remove the triangle is to change the style of the DropDownButton Visibility as follow.

First Create a NuyllToVisibilityConverter.

if the object is null return Visibility.Hidden if not than return Visibility.Visible.

than bind your visibility to the right context menu that you set the property in the DockingManager as I explained above.

Visibility="{Binding Model.Root.Manager.AnchorableContextMenu, RelativeSource={RelativeSource TemplatedParent}, Converter={NullToVisibilityConverter}}

This way when you set the AnchorableContextMenu to null than the triangle will be hidden...

Better than before.

Nov 20, 2013 at 3:21 PM
You can define your own:
        <MenuItem Header="Float" Command="{Binding Path=FloatCommand}"/>
        <MenuItem Header="Dock" Command="{Binding Path=DockCommand}"/>
        <!--<MenuItem Header="Dock as Tabbed Document" Command="{Binding Path=DockAsDocumentCommand}" Visibility="Hidden"/>-->
        <MenuItem Header="Auto Hide" Command="{Binding Path=AutoHideCommand}"/>
        <!-- Feel free to remove this "Hide" entry if you want the exact same behavior as before -->
        <MenuItem Header="Hide" Command="{Binding Path=HideCommand}"/>
        <MenuItem Header="Close" Command="{Binding Path=CloseCommand}"/>
Read here [Version 2.0] CanClose and CanHide not works right on LayoutAnchorable