WPF XAML Namespace issue
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="50开发者_运维技巧4">
<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?)
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 Main.AvalonDock.Views {
internal AvalonDock.DockablePane leftDockablePane;
// ...
}
Using the C# type resolution specs, the AvalonDock resolves to your namespace, not the one in the AvalonDock assembly.
精彩评论