ERIC Sheng
ERIC Sheng

Reputation: 21

WPF xaml failed to load my control from my DLL

I am now working on secondary development of Autodesk Navisworks. The xaml looks like this:

<Window x:Class="SCA.EmergencySystem.Gui.MainFrame.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        xmlns:nc="clr-namespace:SCA.EmergencySystem.NavisInterface.NavisControl;assembly=SCA.EmergencySystem.NavisInterface.NavisControl"
        Height="577.33" Width="879.502" Closed="on_Window_Closed" ShowInTaskbar="False" Title="EmergencySystem">
    <DockPanel>
        <WindowsFormsHost>
            <nc:NavisViewControl x:Uid="viewControl" x:Name="viewControl" Dock="Fill"/>
    </WindowsFormsHost>
    </DockPanel>
</Window>

It seems visual studio succeeded to recognize this line:

xmlns:nc="clr-namespace:SCA.EmergencySystem.NavisInterface.NavisControl;assembly=SCA.EmergencySystem.NavisInterface.NavisControl"

So I think the namespace and assembly are both all right

However, the XAML failed to findout the name of my control that has already been defined in NavisControl.DLL which was loaded to the WPF project. NavisViewControl that derived from System.Windows.Forms.Control and Autodesk.Navisworks.Api.Controls is what I have developed. nc:NavisViewControl is not recognized.

Code of NavisViewControl is simple:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Autodesk.Navisworks.Api.Controls;

namespace SCA.EmergencySystem.NavisInterface.NavisControl
{
    public class NavisViewControl : ViewControl
    {
    }
}

Upvotes: 2

Views: 330

Answers (0)

Related Questions