我正在尝试在 WPF 中使用 ScintillaNET
(通过 Windows Forms Host
)。但是,我收到无效的 XAML 标记。我的 XAML 代码是:
<Window x:Class="ObjectiveWin.Editor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:scintilla="clr-namespace:ScintillaNET"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ObjectiveWin 2013 Express" Height="392.537" Width="628.358" WindowState="Maximized" Loaded="editor_Loaded">
<Grid>
<WindowsFormsHost HorizontalAlignment="Left" Height="340" Margin="0,22,0,0" VerticalAlignment="Top" Width="620">
<scintilla:Scintilla></scintilla:Scintilla>
</WindowsFormsHost>
</Grid>
但是,Visual Studio 2012 给我这些错误:
命名空间“clr-namespace:ScintillaNET”中不存在名称 Scintilla。
XML 命名空间“clr-namespace:ScintillaNET”中不存在标记“Scintilla”。第 8 行位置 14.'
找不到名称“scintilla:Scintilla”。验证您没有缺少程序集引用并且所有引用的程序集都已构建
我究竟做错了什么?如果重要的话,我正在使用 .NET Framework 4.5
和 VS2012
最佳答案
你有错误的命名空间(msdn)。
assembly can be omitted if the clr-namespace referenced is being defined within the same assembly as the application code that is referencing the custom classes.
检查这个命名空间:
xmlns:scintilla="clr-namespace:ScintillaNET;assembly=ScintillaNET"
关于c# - WPF XAML 问题中的 ScintillaNET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18559516/