wpf 将 AvalonDock 从 1.3 升级到 2.0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11881770/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 04:55:00  来源:igfitidea点击:

Upgrade AvalonDock from 1.3 to 2.0

c#wpfavalondock

提问by Frozendragon

I'm trying to upgrade AvalonDock in a application from 1.3 to 2.0 but there exist little to no documentation on this.

我正在尝试将应用程序中的 AvalonDock 从 1.3 升级到 2.0,但几乎没有关于此的文档。

I look at the simple, imported it by doing this

我看看简单的,通过这样做导入它

xmlns:avalonDock="http://avalondock.codeplex.com"

However this did not work.

然而这并没有奏效。

Error   The tag 'DockingManager' does not exist in XML namespace 'http://avalondock.codeplex.com'. Line 41 Position 10.

I also tried it the old way.

我也用旧方法试过了。

xmlns:avalonDock="clr-namespace:AvalonDock;assembly=AvalonDock"

Neither did this work

这也没有工作

Error   The tag 'ResizingPanel' does not exist in XML namespace 'clr-namespace:AvalonDock;assembly=AvalonDock'. Line 71 Position 22.

If they have renamed the controls it would be useful to have a list of the controls now existing in 2.0.

如果他们重命名了控件,那么拥有一个现在存在于 2.0 中的控件列表会很有用。

I tried to compile the simple code as it was but without success.

我试图按原样编译简单的代码,但没有成功。

采纳答案by Malgaur

The only documentation currently available is the AvalonDock samples that can be downloaded from codeplex. http://avalondock.codeplex.com/releases

当前唯一可用的文档是可以从 codeplex 下载的 AvalonDock 示例。http://avalondock.codeplex.com/releases

Beyond this, the intellisense is a helpful guide.

除此之外,智能感知是一个有用的指南。

============================================================

================================================== ==========

The error you are seeing for 'DockingManager' is misleading as it still exists in 2.0. The following may help you get rid of those. Additionally, intellisense will begin to work once this is resolved.

您看到的“DockingManager”错误具有误导性,因为它仍然存在于 2.0 中。以下内容可以帮助您摆脱这些。此外,一旦解决此问题,智能感知将开始工作。

Bad things happen with files downloaded from the internet. They have an attribute on them that leads to limited access. You have to manually remove this attribute in order for the XAML to stop fussing.

从 Internet 下载的文件会发生不好的事情。它们具有导致访问受限的属性。您必须手动删除此属性,以便 XAML 停止大惊小怪。

In windows explorer, right-click the file, choose properties, then click the 'Unblock' button. Do this for every individual file you are using that was downloaded from the internet. Be sure to rebuild the project to replace the blocked copy in the bin folder as well.

在 Windows 资源管理器中,右键单击该文件,选择属性,然后单击“取消阻止”按钮。对您使用的从 Internet 下载的每个单独文件执行此操作。确保重建项目以替换 bin 文件夹中的被阻止的副本。

As a side note, I am able to still run the project whenever this is the issue. Only the XAML editor thinks that there is a problem.

作为旁注,只要出现问题,我仍然可以运行该项目。只有 XAML 编辑器认为有问题。

============================================================

================================================== ==========

In 2.0, everything is nested in layout controls. All of your panes are either anchorable or document style. Here is a quick example to get you going.

在 2.0 中,一切都嵌套在布局控件中。您的所有窗格都是可锚定的或文档样式的。这是一个快速示例,可让您继续前进。

Define your namespace

定义你的命名空间

xmlns:ad="http://avalondock.codeplex.com"

Build your DockingManager

构建您的 DockingManager

<ad:DockingManager x:Name="dockManager">
    <ad:LayoutRoot>
        <ad:LayoutPanel Orientation="Horizontal">
            <ad:LayoutPanel Orientation="Vertical">
                <ad:LayoutPanel Orientation="Horizontal">
                    <ad:LayoutDocumentPaneGroup x:Name="leftDocumentGroup">
                        <ad:LayoutDocumentPane>
                            <ad:LayoutDocument Title="Left Doc"></ad:LayoutDocument>
                        </ad:LayoutDocumentPane>
                    </ad:LayoutDocumentPaneGroup>
                    <ad:LayoutDocumentPaneGroup x:Name="rightDocumentGroup">
                        <ad:LayoutDocumentPane>
                            <ad:LayoutDocument Title="Right Doc"></ad:LayoutDocument>
                        </ad:LayoutDocumentPane>
                    </ad:LayoutDocumentPaneGroup>
                </ad:LayoutPanel>
                <ad:LayoutAnchorablePaneGroup x:Name="bottomAnchorableGroup">
                    <ad:LayoutAnchorablePane>
                        <ad:LayoutAnchorable Title="Bottom Anch"></ad:LayoutAnchorable>
                    </ad:LayoutAnchorablePane>
                </ad:LayoutAnchorablePaneGroup>
            </ad:LayoutPanel>
            <ad:LayoutAnchorablePaneGroup x:Name="rightAnchorableGroup">
                <ad:LayoutAnchorablePane>
                    <ad:LayoutAnchorable Title="Right Anch"></ad:LayoutAnchorable>
                </ad:LayoutAnchorablePane>
            </ad:LayoutAnchorablePaneGroup>
        </ad:LayoutPanel>
    </ad:LayoutRoot>
</ad:DockingManager>

回答by Patedam

I fixed this issue by replacing

我通过替换解决了这个问题

xmlns:avalonDock="http://avalondock.codeplex.com"

xmlns:avalonDock="http://avalondock.codeplex.com"

by

经过

xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"

xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"

回答by mili

You can add reference to latest AvalonDock version using following command. So you have to enter this command on Package Manager Consoleon Visual Studio

您可以使用以下命令添加对最新 AvalonDock 版本的引用。所以你必须在 Visual Studio 的包管理器控制台上输入这个命令

Install-Package AvalonDock

You can find this window on vs from the Toolsmenu, select Library Package Managerand then click Package Manager Console. (More details)

您可以在 vs 上的Tools菜单中找到此窗口,选择Library Package Manager,然后单击Package Manager Console。(更多详情

Then it will add all the reference to your project automatically !!!

然后它会自动添加对您项目的所有引用!!!

Also replace this line

也替换这一行

xmlns:avalonDock="http://avalondock.codeplex.com"

by

经过

xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"

As describes by Paul Gillen

正如保罗·吉伦所描述的那样

回答by tbergelt

You need to define your namespace as xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"

您需要将命名空间定义为 xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"

You also need to ensure your project is configured to use .NET 4 or later.

您还需要确保您的项目配置为使用 .NET 4 或更高版本。

回答by burnttoast11

I had a similar error message when I first switched to AvalonDock 2.0. This is probably a long shot, but do you have the AvalonDock.dll on a network drive? I found that once I moved the DLL to my project directory I no longer had that problem.

当我第一次切换到 AvalonDock 2.0 时,我收到了类似的错误消息。这可能是一个长镜头,但是您在网络驱动器上有 AvalonDock.dll 吗?我发现一旦我将 DLL 移动到我的项目目录中,我就不再有这个问题了。

.NET assembly runs in partial trust on a network drive, but all other in full trust

.NET 程序集在网络驱动器上以部分信任的方式运行,但所有其他程序以完全信任的方式运行

(I would have added this answer as a comment but I don't have rep to add comments.)

(我会将此答案添加为评论,但我没有代表添加评论。)

回答by Vladimir Oselsky

In my case I had two issues, first was file was blocked and it had to be resolved by unblocking it from file explorer.

在我的情况下,我有两个问题,首先是文件被阻止,必须通过从文件资源管理器中取消阻止来解决它。

enter image description here

在此处输入图片说明

Second I had to change the reference to the new address. Change from the following link that listed on AvalodDock Documentation

其次,我不得不更改对新地址的引用。从AvalodDock 文档中列出的以下链接更改

xmlns:avalonDock="http://avalondock.codeplex.com"

to the new link

到新链接

xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"

Which also shows up in Intellisense

这也出现在 Intellisense 中

enter image description here

在此处输入图片说明

I'm running.

我在跑。

AvalonDock version:2.0.2000.0

AvalonDock 版本:2.0.2000.0

.NET Framework 4.6.1

.NET 框架 4.6.1