是否DockingManager配备用于处理Anchorables一个内置的方法 [英] Does the DockingManager come with a built-in method for handling Anchorables

查看:756
本文介绍了是否DockingManager配备用于处理Anchorables一个内置的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一组Anchorables的设置AvalonDock,例如:

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>
<!-- ... -->



请问DockingManager(或AvalonDock别的东西),配有内置的方式
管理Anchorables的被关闭?它们是存储在一个集合中,以便某处它们可以被检索和重新显示?

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?

例如,用户关闭从上面的代码(A1)第一个,会发生什么呢?

我怎样才能显示它再?

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

什么是典型的工作流程来处理关闭和恢复anchorables?

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

推荐答案

当你添加了 xceed 标记,我假设你正在使用Avalondock 2.0。

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

例如,用户关闭从上面的代码(A1),
到会发生什么?

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

您anchorable被隐藏。如果您选择命名anchorable(例如:< A:LayoutAnchorable标题=A1X:NAME =myAnchorable> ),您将在看到您的视图代码 this.myAnchorable.IsHidden 变成真正

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.

我怎么能再次显示呢?

呼叫 .Show ()对你anchorable: this.myAnchorable.Show();

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

话虽这么说,Avalondock 2.0为1.0完全不同,因为它现在允许使用MVVM(尤其是绑定)很容易。所以最好的做法是不是静态添加 LayoutAnchorable 在XAML,但管理的ViewModels的集合,而不是(用绑定到 AnchorablesSource DockingManager财产)。然后,它很容易显示/隐藏anchorables,因为你只需要获取/设置绑定到可见你的ViewModel财产的属性 LayoutAnchorableItem

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.

您可以看一下WPF例子Avalondock提供。这是一个名为 AvalonDock.MVVMTestApp 他们的代码源。

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

这篇关于是否DockingManager配备用于处理Anchorables一个内置的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆