-1

I'm developing a vb.net WPF application (not using MVVM) that contains an AvalonDock LayoutAnchorable. What I want to know is, is there a way to remove the built-in Down-Arrow combo button that provides docking options from the LayoutAnchorable?

Somanna
  • 284
  • 1
  • 13

1 Answers1

1

I do not think that there is an option to hide the drop-down button completely out-of-the-box. The anchorables do not seem to provide any properties or methods for hiding the button or customizing the header template easily.

However, you can remove the button for all anchorables by modifying the AnchorablePaneTitle style. You can find the default styles depening on your theme on GitHub in one of the Xceed.Wpf.AvalonDock.Themes.* directories. The styles are defined in Theme.xaml. You most likely use Aero, if you did not specify anything else.

Copy the style, e.g. Aero, to a resource dictionary in scope or the application resources. Then you can go to the drop-down button definition and set its Visibility to Collapsed. Do not delete this part, it is easier to simply hide it.

<xcad:DropDownButton x:Name="MenuDropDownButton"
                     Visibility="Collapsed"
                     ... />

Keep in mind that this is not an easy edit, as it requires you to adapt the XML namespaces to the ones that you have imported in your XAML file and adapting the file paths to point to the right assembly, e.g.:

  • avalonDockProperties:Resources.Anchorable_BtnAutoHide_Hint would become xcad:Resources.Anchorable_BtnAutoHide_Hint for me, as I have added the corresponding namespce as xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
  • The file path Images/PinAutoHide_Dark.png is only valid in the source assembly, so it would become pack://application:,,,/Xceed.Wpf.AvalonDock.Themes.Aero;component/Images/PinClose_Dark.png ``

You could also reset the AnchorableContextMenu. It would prevent the context menu on the anchorables from showing up. If you did not modify the template, it would also prevent the drop-down button from showing any menu items, but the drop-down button would still be visible and clickable.

<xcad:DockingManager AnchorableContextMenu="{x:Null}">

Look at this image for a comparsion of the original and the modified template.

Anchorables comparison

thatguy
  • 21,059
  • 6
  • 30
  • 40