Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the DockingManager come with a built-in method for handling Anchorables

When setting up AvalonDock with a set of Anchorables, for example:

<a:LayoutRoot>
    <a:LayoutPanel Orientation="Horizontal">    
        <a:LayoutAnchorablePane>
            <a:LayoutAnchorable Title="A1">
                <!-- content -->
            </a:LayoutAnchorable>
            <a:LayoutAnchorable Title="A2">
                <!-- content -->
            </a:LayoutAnchorable>
    </a:LayoutAnchorablePane>
<!-- ... -->

Does the DockingManager (or something else in AvalonDock) come with a built-in way of managing Anchorables that are closed? Are they stored in a collection somewhere so they can be retrieved and shown again?

For example, the user closes the first one from the code above (A1), what happens to it?
How can I display it again?

What's the typical workflow to deal with closing and restoring anchorables?

like image 398
TimothyP Avatar asked Feb 11 '14 04:02

TimothyP


1 Answers

As you added the xceed tag, I assume you're using Avalondock 2.0.

For example, the user closes the first one from the code above (A1), what happens to it?

You anchorable becomes hidden. If you choose to name your anchorable (example: <a:LayoutAnchorable Title="A1" x:Name="myAnchorable">), you'll see in the code of your view that this.myAnchorable.IsHidden becomes true.

How can I display it again?

Call .Show() against your anchorable: this.myAnchorable.Show();


That being said, Avalondock 2.0 is totally different from 1.0 because it now allows to use MVVM (especially bindings) easily. So the best practice would be to not statically add LayoutAnchorable in the XAML, but manage a collection of ViewModels instead (with a binding to the AnchorablesSource property of the DockingManager). Then it's easy to show/hide anchorables because you just have to get/set your ViewModel property that is bound to the Visibility property of LayoutAnchorableItem.

You could look at the WPF example Avalondock provides. It's the project named AvalonDock.MVVMTestApp in their code source.

like image 123
ken2k Avatar answered Oct 24 '22 06:10

ken2k