[Version 2.0] AnchorableCloseCommand

Apr 18, 2012 at 8: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??

 

Daniel

Apr 21, 2012 at 6: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}">
...
<Button 
  shell:WindowChrome.IsHitTestVisibleInChrome="True"
  Focusable="False"
  Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
  Command="{Binding Model.Root.Manager.AnchorableHideCommand, RelativeSource={RelativeSource TemplatedParent}}"
  CommandParameter="{Binding Model.SinglePane, RelativeSource={RelativeSource TemplatedParent}}"
  Grid.Column="3">
    <Image Source="/AvalonDock;component/Images/PinClose.png"/>
</Button>

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

 

Apr 23, 2012 at 10: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.

Ado

Apr 23, 2012 at 10:57 AM

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

 

Daniel

Apr 24, 2012 at 4: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 9:30 AM

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