WPF XAML 命名空间问题
使用以下代码:
<ad:DockingManager x:Class="Main.AvalonDock.Views.AvalonDockView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
xmlns:cal="http://www.codeplex.com/prism"
mc:Ignorable="d"
d:DesignHeight="293" d:DesignWidth="504">
<ad:ResizingPanel Margin="0,10,0,10" Orientation="Horizontal" >
<ad:DockablePane cal:RegionManager.RegionName="MainLeftRegion" Name="leftDockablePane" />
<ad:DocumentPane cal:RegionManager.RegionName="MainCenterRegion" Name="mainDocumentPane" />
<ad:DockablePane cal:RegionManager.RegionName="MainRightRegion" Name="rightDockablePane" />
</ad:ResizingPanel>
</ad:DockingManager>
我的项目名称是 Main.AvalonDock,它使用 AvalonDock 控件。由于广告命名空间和项目命名空间之间存在差异,它将无法编译。有解决方法吗?
错误如下:
类型或命名空间名称 “DockablePane”不存在于 名称空间 'Main.AvalonDock' (你是否缺少一个程序集 参考?)
Using the following code:
<ad:DockingManager x:Class="Main.AvalonDock.Views.AvalonDockView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
xmlns:cal="http://www.codeplex.com/prism"
mc:Ignorable="d"
d:DesignHeight="293" d:DesignWidth="504">
<ad:ResizingPanel Margin="0,10,0,10" Orientation="Horizontal" >
<ad:DockablePane cal:RegionManager.RegionName="MainLeftRegion" Name="leftDockablePane" />
<ad:DocumentPane cal:RegionManager.RegionName="MainCenterRegion" Name="mainDocumentPane" />
<ad:DockablePane cal:RegionManager.RegionName="MainRightRegion" Name="rightDockablePane" />
</ad:ResizingPanel>
</ad:DockingManager>
My projects name is Main.AvalonDock which uses the AvalonDock control. It will not compile because of a discrepancy between the ad namespace and the project namespace. Is there a workaround?
heres the error:
The type or namespace name
'DockablePane' does not exist in the
namespace
'Main.AvalonDock'
(are you missing an assembly
reference?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您查看项目 obj 文件夹中的 AvalonDockView.g.cs(或 AvalongDockView.g.vb),您将看到根本问题。
基本上,您最终会得到类似的结果:
使用 C# 类型解析规范,AvalonDock 解析为您的命名空间,而不是 AvalonDock 程序集中的命名空间。
If you look at the AvalonDockView.g.cs (or AvalongDockView.g.vb) in your projects obj folder, you will see the underlying issue.
Basically, you'd end up with something like:
Using the C# type resolution specs, the AvalonDock resolves to your namespace, not the one in the AvalonDock assembly.