[Version 2.0] AnchorableCloseCommand

Apr 18, 2012 at 9:28 AM

Hi, I use the last build of AD and the binding of AnchorableCloseCommand dosen't work.

I've test it also with your MVVM Test application.

Is my fault??



Apr 21, 2012 at 7:49 PM


adospace wrote Apr 11 at 7:54 PM
By default the x button fires the AnchorableHideCommand, the dropdown menuitem the AnchorableCloseCommand,
(depending on the theme loaded)

so i've bound both hide and close to the same command and modified the VS2010 theme for the floating window
<Style x:Key="{x:Type avalonDockControls:LayoutAnchorableFloatingWindowControl}" TargetType="{x:Type avalonDockControls:LayoutAnchorableFloatingWindowControl}">
  Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
  Command="{Binding Model.Root.Manager.AnchorableHideCommand, RelativeSource={RelativeSource TemplatedParent}}"
  CommandParameter="{Binding Model.SinglePane, RelativeSource={RelativeSource TemplatedParent}}"
    <Image Source="/AvalonDock;component/Images/PinClose.png"/>

because on default, it just closes the floating window without firing the command and with above modification it does.


Apr 23, 2012 at 11:25 AM

Hum, I think you need to hande both commands, because they are used for different purposes. The hide command put the content in the DockingManager.Layout.Hidden collection and saves the previous container so that you can simply use the show method to reshown the content where it was previous hidden. The Close command instead call the Close method by default that removes it from the layout.


Apr 23, 2012 at 11:57 AM

Thanks, now i understand the difference between hide and close.



Apr 24, 2012 at 5:42 PM

" I think you need to hande both commands"
true, but when you close a floating window, neither gets called, you just called the system command to close the window. 

Apr 25, 2012 at 10:30 AM

@Stino, ops, sorry you are right, next version will contain your fix thanks