gpt4 book ai didi

c# - DockingManager 是否带有用于处理 Anchorables 的内置方法

转载 作者:太空狗 更新时间:2023-10-29 17:46:30 26 4
gpt4 key购买 nike

例如,使用一组 Anchorables 设置 AvalonDock 时:

<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 中的其他东西)是否带有内置方式管理关闭的 anchor ?它们是否存储在某处的集合中以便可以检索并再次显示?

例如,用户关闭了上面代码中的第一个(A1),会发生什么?
如何再次显示?

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

最佳答案

当您添加 xceed标记,我假设您使用的是 Avalondock 2.0。

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

您可锚定的变为隐藏状态。如果您选择命名您的 anchor (例如:<a:LayoutAnchorable Title="A1" x:Name="myAnchorable">),您将在 View 的代码中看到 this.myAnchorable.IsHidden。变成 true .

How can I display it again?

调用.Show()针对你的 anchor :this.myAnchorable.Show();


也就是说,Avalondock 2.0 与 1.0 完全不同,因为它现在允许轻松使用 MVVM(尤其是绑定(bind))。所以最好的做法是不要静态添加 LayoutAnchorable在 XAML 中,而是管理 ViewModel 的集合(绑定(bind)到 AnchorablesSourceDockingManager 属性)。然后很容易显示/隐藏 anchor ,因为您只需要获取/设置绑定(bind)到 Visibility 的 ViewModel 属性。 LayoutAnchorableItem的属性(property).

您可以查看 Avalondock 提供的 WPF 示例。这是名为 AvalonDock.MVVMTestApp 的项目在 their code source .

关于c# - DockingManager 是否带有用于处理 Anchorables 的内置方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21692918/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com