syncfusion-wpf-syntax-editor — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited syncfusion-wpf-syntax-editor (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Guide for implementing Syncfusion® WPF Syntax Editor (EditControl) — an advanced code and text editor control for creating IDE-like editing experiences with syntax highlighting, IntelliSense, find/replace, and comprehensive editing features for multiple programming languages.
Use this skill when you need to:
This skill covers the complete Syntax Editor implementation including basic setup, language configuration, editing features, customization, and advanced scenarios.
The Syntax Editor (EditControl) is a high-performance text and code editor control that provides:
EditControl
├── Editor Area - Main text editing surface
│ ├── Line Numbers (optional)
│ ├── Folding Indicators (optional)
│ └── Text Content with Syntax Highlighting
├── Context Menu - Right-click operations
├── Status Bar (optional) - Position and mode info
└── IntelliSense Popup - Auto-completion suggestions📄 Read: references/getting-started.md
📄 Read: references/overview.md
📄 Read: references/file-operations.md
📄 Read: references/syntax-highlighting.md
📄 Read: references/supported-languages.md
📄 Read: references/custom-language-support.md
📄 Read: references/intellisense.md
📄 Read: references/editing-text.md
📄 Read: references/edit-commands.md
📄 Read: references/selection.md
📄 Read: references/find-and-replace.md
📄 Read: references/text-navigation.md
📄 Read: references/line-numbers.md
📄 Read: references/expand-collapse.md
📄 Read: references/context-menu.md
📄 Read: references/status-bar.md
📄 Read: references/customization.md
📄 Read: references/advanced-features.md
<Window x:Class="CodeEditorApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Toolbar -->
<ToolBar Grid.Row="0">
<Button Content="Open" Click="OpenFile_Click"/>
<Button Content="Save" Click="SaveFile_Click"/>
<Separator/>
<ComboBox Name="languageComboBox"
SelectionChanged="Language_Changed"
Width="120">
<ComboBoxItem Content="C#" Tag="CSharp"/>
<ComboBoxItem Content="Visual Basic" Tag="VB"/>
<ComboBoxItem Content="XAML" Tag="XAML"/>
<ComboBoxItem Content="XML" Tag="XML"/>
</ComboBox>
</ToolBar>
<!-- Syntax Editor -->
<syncfusion:EditControl Name="editControl"
Grid.Row="1"
DocumentLanguage="CSharp"
ShowLineNumber="True"
EnableOutlining="True"
EnableIntellisense="True"
Background="White"
FontSize="12"
FontFamily="Consolas"/>
</Grid>
</Window>using Syncfusion.Windows.Edit;
using Microsoft.Win32;
using System.IO;
using System.Windows;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
// Set initial language
editControl.DocumentLanguage = Languages.CSharp;
languageComboBox.SelectedIndex = 0;
}
private void OpenFile_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog
{
Filter = "C# Files (*.cs)|*.cs|VB Files (*.vb)|*.vb|XAML Files (*.xaml)|*.xaml|All Files (*.*)|*.*"
};
if (dialog.ShowDialog() == true)
{
editControl.Load(dialog.FileName);
// Auto-detect language from extension
string ext = Path.GetExtension(dialog.FileName).ToLower();
switch (ext)
{
case ".cs":
editControl.DocumentLanguage = Languages.CSharp;
break;
case ".vb":
editControl.DocumentLanguage = Languages.VB;
break;
case ".xaml":
editControl.DocumentLanguage = Languages.XAML;
break;
case ".xml":
editControl.DocumentLanguage = Languages.XML;
break;
}
}
}
private void SaveFile_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog
{
Filter = "C# Files (*.cs)|*.cs|VB Files (*.vb)|*.vb|XAML Files (*.xaml)|*.xaml|All Files (*.*)|*.*"
};
if (dialog.ShowDialog() == true)
{
editControl.Save(dialog.FileName);
}
}
private void Language_Changed(object sender, SelectionChangedEventArgs e)
{
if (editControl == null) return;
var selected = (ComboBoxItem)languageComboBox.SelectedItem;
string language = selected.Tag.ToString();
switch (language)
{
case "CSharp":
editControl.DocumentLanguage = Languages.CSharp;
break;
case "VB":
editControl.DocumentLanguage = Languages.VB;
break;
case "XAML":
editControl.DocumentLanguage = Languages.XAML;
break;
case "XML":
editControl.DocumentLanguage = Languages.XML;
break;
}
}
}// Load file with specific encoding
editControl.Load("path/to/file.cs", Encoding.UTF8);
// Save with encoding
editControl.Save("path/to/output.cs", Encoding.UTF8);
// Load from stream
using (FileStream stream = new FileStream("file.cs", FileMode.Open))
{
editControl.Load(stream, Encoding.UTF8);
}
// Save to stream
using (FileStream stream = new FileStream("output.cs", FileMode.Create))
{
editControl.Save(stream, Encoding.UTF8);
}// Enable IntelliSense in Custom mode
editControl.EnableIntellisense = true;
editControl.IntellisenseMode = IntellisenseMode.Custom;
// Business object must implement IIntellisenseItem
public class MyIntellisenseItem : IIntellisenseItem
{
public ImageSource Icon { get; set; }
public string Text { get; set; }
public IEnumerable<IIntellisenseItem> NestedItems { get; set; }
}
// Build custom items collection and assign to IntellisenseCustomItemsSource
var customItems = new ObservableCollection<MyIntellisenseItem>
{
new MyIntellisenseItem { Text = "CustomMethod" },
new MyIntellisenseItem { Text = "CustomProperty" },
new MyIntellisenseItem { Text = "Console" }
};
editControl.IntellisenseCustomItemsSource = customItems;
// Handle IntelliSenseBoxOpening event to filter items at runtime
editControl.IntelliSenseBoxOpening += (s, e) =>
{
// e.ItemsSource contains current items; set e.Cancel = true to suppress popup
if (string.IsNullOrEmpty(editControl.Text))
e.Cancel = true;
};// Simple find
FindResult result = editControl.FindText("SearchTerm",
FindOptions.MatchCase | FindOptions.WholeWord);
if (result != null)
{
Console.WriteLine($"Found at line {result.LineNumber}");
}
// Find with regex
FindResult regexResult = editControl.FindText(@"\d{3}-\d{4}",
FindOptions.UseRegularExpressions);
// Replace all occurrences
int replacedCount = editControl.ReplaceAll("oldText", "newText",
FindOptions.MatchCase);
// Replace with confirmation
while (editControl.FindNext("oldText", FindOptions.None))
{
var dialogResult = MessageBox.Show("Replace this occurrence?",
"Confirm", MessageBoxButton.YesNoCancel);
if (dialogResult == MessageBoxResult.Yes)
editControl.SelectedText = "newText";
else if (dialogResult == MessageBoxResult.Cancel)
break;
}Define formats and lexems as XAML resources, then apply them to a class that inherits ProceduralLanguageBase:
<!-- Define formats in XAML Resources -->
<syncfusion:FormatsCollection x:Key="myLangFormats">
<syncfusion:EditFormats Foreground="Blue" FormatName="KeywordFormat"/>
<syncfusion:EditFormats Foreground="Green" FormatName="CommentFormat"/>
<syncfusion:EditFormats Foreground="Brown" FormatName="StringFormat"/>
</syncfusion:FormatsCollection>
<!-- Define lexems in XAML Resources -->
<syncfusion:LexemCollection x:Key="myLangLexems">
<syncfusion:Lexem StartText="function" LexemType="Keyword" FormatName="KeywordFormat" ContainsEndText="False" IsMultiline="False"/>
<syncfusion:Lexem StartText="if" LexemType="Keyword" FormatName="KeywordFormat" ContainsEndText="False" IsMultiline="False"/>
<syncfusion:Lexem StartText="while" LexemType="Keyword" FormatName="KeywordFormat" ContainsEndText="False" IsMultiline="False"/>
<syncfusion:Lexem StartText="//" EndText="\r\n" LexemType="Comment" FormatName="CommentFormat" ContainsEndText="True" IsMultiline="False"/>
<syncfusion:Lexem StartText=""" EndText=""" LexemType="Literals" FormatName="StringFormat" ContainsEndText="True" IsMultiline="False"/>
</syncfusion:LexemCollection>// Create custom language class inheriting ProceduralLanguageBase
public class MyLanguage : ProceduralLanguageBase
{
public MyLanguage(EditControl control) : base(control)
{
Name = "MyLanguage";
FileExtension = "mylang";
ApplyColoring = true;
SupportsOutlining = false;
SupportsIntellisense = false;
TextForeground = Brushes.Black;
}
}
// Wire up resources and apply the custom language
EditControl editControl = new EditControl();
editControl.DocumentLanguage = Languages.Custom;
MyLanguage customLanguage = new MyLanguage(editControl);
customLanguage.Lexem = Application.Current.Resources["myLangLexems"] as LexemCollection;
customLanguage.Formats = Application.Current.Resources["myLangFormats"] as FormatsCollection;
editControl.CustomLanguage = customLanguage;// Enable outlining
editControl.EnableOutlining = true;
// Collapse all regions
editControl.CollapseAll();
// Expand all regions
editControl.ExpandAll();
// Toggle specific region
editControl.ToggleOutlining(lineNumber);
// Programmatically add folding region
editControl.AddFoldingRegion(startLine, endLine, "Region Name");
// Handle outlining events
editControl.OutlineCollapsed += (s, e) =>
{
Console.WriteLine($"Collapsed region at line {e.StartLine}");
};| Property | Type | Description |
|---|---|---|
| Text | string | Gets/sets the entire text content |
| DocumentLanguage | ILanguage | Current language for syntax highlighting |
| ShowLineNumber | bool | Shows/hides line numbers |
| EnableIntellisense | bool | Enables IntelliSense features |
| EnableOutlining | bool | Enables code folding |
| IsReadOnly | bool | Makes editor read-only |
| SingleLineMode | bool | Uses editor as single-line TextBox |
| Property | Type | Description |
|---|---|---|
| SelectedText | string | Gets/sets currently selected text |
| SelectionStart | int | Selection start position |
| SelectionLength | int | Length of selection |
| CurrentLine | int | Current cursor line number |
| CurrentColumn | int | Current cursor column position |
| Property | Type | Description |
|---|---|---|
| FontFamily | FontFamily | Editor font |
| FontSize | double | Editor font size |
| Background | Brush | Editor background |
| Foreground | Brush | Default text color |
| LineNumberForeground | Brush | Line number color |
| SelectionBrush | Brush | Selection background color |
| Property | Type | Description |
|---|---|---|
| AllowDragDrop | bool | Enables text drag-drop |
| WordWrap | bool | Enables word wrapping |
| TabSize | int | Tab character width |
| UseSpacesInsteadOfTabs | bool | Converts tabs to spaces |
| AutoIndent | bool | Automatic indentation |
| Event | Description |
|---|---|
| TextChanged | Fired when text content changes |
| SelectionChanged | Fired when selection changes |
| DocumentLanguageChanged | Fired when language changes |
| IntellisenseOpening | Fired before showing IntelliSense popup |
| OutlineCollapsed | Fired when outline region collapses |
| OutlineExpanded | Fired when outline region expands |
Build development environments with syntax highlighting, IntelliSense, and debugging integration.
Create editors for XML, JSON, YAML configuration files with validation and auto-completion.
Display and analyze log files with syntax highlighting for different log levels and patterns.
Build database query tools with SQL syntax highlighting and query execution.
Create scripting environments for PowerShell, Python, or custom scripting languages.
Implement markdown editors with live preview and syntax highlighting.
Build template editing tools for code generation or document templates.
Create learning applications with code highlighting and interactive examples.
DocumentLanguage based on file extensionBeginUpdate()/EndUpdate() for bulk text operationsDocumentLanguage is set correctlyEnableIntellisense is trueIntellisenseMode settingBeginUpdate()/EndUpdate() for batch operationsShowLineNumber is trueNext Steps: Navigate to specific reference documents based on your implementation needs. Start with getting-started.md for initial setup, then explore syntax highlighting, IntelliSense, and editing features as needed.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.