ScintillaNET in WPF XAML Issues

4k views Asked by At

I am trying to use ScintillaNET in WPF (via the Windows Forms Host). However I am getting an invalid XAML markup. My XAML code is:

<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>

However, Visual Studio 2012 gives me these errors:

  1. The name Scintilla does not exist in the namespace "clr-namespace:ScintillaNET".
  2. The tag 'Scintilla' does not exist in XML namespace 'clr-namespace:ScintillaNET. Line 8 position 14.'

  3. The name 'scintilla:Scintilla' was not found. Verify you are not missing an assembly reference and that all referenced assemblies have been built

What exactly am I doing wrong? If it matters, I am using .NET Framework 4.5 with VS2012

2

There are 2 answers

5
kmatyaszek On BEST ANSWER

You have wrong namespace (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.

Check this namespace:

xmlns:scintilla="clr-namespace:ScintillaNET;assembly=ScintillaNET"
0
Stefan Flipkens On

I've encountered the same issue. While searching I found a post about a seperate WPF branch referring to http://scintillanet.codeplex.com/SourceControl/latest.

If you go there and click on Branches, you can see it.

I downloaded this one and build it, then I added ScintillaNET.dll and ScintillaNET.WPF.dll to my WPF application.

But still no luck, when comparing my project with the project I got from codeplex, which worked I'v found that

My Application: Project Properties -> Application -> Target Framework was set to .NET Framework 4 Client Profile (this is not the full .NET FrameWork 4 but a light version)

The Application from codeplex was set to .NET Framework 4. After changing my application to the full .NET Framework 4, all issues where gone.

Namespace I added to my XAML

xmlns:sn="http://scintillanet.codeplex.com"