
I'm contemplating updating my old (v3) Syntax Editor for Winforms to Silverlight. Looking at the sample app it appears that all I need to do to get the GettingStarted01 working is start a new Silverlight project and:
1) Create MainPage.xaml
--------------------------------------------------------------------------------------
<UserControl x:Class="TestSyntaxEditorSL.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:editor="http://schemas.actiprosoftware.com/winfx/xaml/syntaxeditor"
d:DesignHeight="300" d:DesignWidth="400">
<editor:SyntaxEditor x:Name="editor">
<editor:EditorDocument>
<system:String xml:space="preserve">/*
The Simple language is a simplistic C-like language that only knows
several keywords and operators. All variables are integer numbers.
This first sample shows a language project (.langproj) file and
generated language definition (.langdef) file that have been created
using the Actipro Language Designer application. Language projects
are the fastest way to get up and running with a language as they make
it easy to configure syntax highlighting. See the product documentation
for more information on .langproj and .langdef files.
The .langdef file is included in the project as an Embedded Resource
from within the /ProductSamples/SyntaxEditorSamples/Languages/Definitions
folder and is loaded into a SyntaxEditor instance at run-time to
provide the basic syntax highlighting features you see here.
*/
function Add(x, y) {
return x + y;
}
function Increment(x) {
return (x + 1);
}
function IncrementAndMultiply(x, y) {
// This function calls another function
var result;
result = Increment(x);
return result * y;
}
</system:String>
</editor:EditorDocument>
</editor:SyntaxEditor>
</UserControl>
--------------------------------------------------------------------------------------
2) Create a codebehind MainPage.xaml.vb
--------------------------------------------------------------------------------------
Imports System.Windows.Resources
Imports System.IO
Partial Public Class MainPage
Inherits UserControl
Public Sub New()
InitializeComponent()
editor.Document.Language = SyntaxEditorHelper.LoadLanguageDefinitionFromResourceStream("Simple-Basic.langdef")
End Sub
End Class
--------------------------------------------------------------------------------------
3) Add Simple-Basic.langdef to my project as "Embedded Resource", add a copy of SyntaxEditorHelper.vb and run it.
This code runs but there is no syntax highlighting as shown. It looks like a regular multiline text editor.
What am I missing?
Thanks.
-Al