UI.SyntaxBox
1.0.0
dotnet add package UI.SyntaxBox --version 1.0.0
NuGet\Install-Package UI.SyntaxBox -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="UI.SyntaxBox" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UI.SyntaxBox" Version="1.0.0" />
<PackageReference Include="UI.SyntaxBox" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add UI.SyntaxBox --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: UI.SyntaxBox, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package UI.SyntaxBox@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=UI.SyntaxBox&version=1.0.0
#tool nuget:?package=UI.SyntaxBox&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Fork: UI.SyntaxBox
UI.SyntaxBox
Attach syntax highlighting to a WPF TextBox.
The SyntaxBox behavior attaches syntax highlighting capabilities to an existing .NET Framework WPF TextBox. It supports two distinct rule types for syntax syntax recognition, RegexRule and a much faster, custom KeywordRule based on the Aho-Corasick algorithm, all configured directly in XAML.
Here an example of using the SyntaxBox for syntax highlighting ofsomething approximating C# code:
// xmlns:syntax="clr-namespace:UI.SyntaxBox;assembly=UI.SyntaxBox"
// ...
<TextBox
x:Name="textBox"
syntax:SyntaxBox.Enable="True"
syntax:SyntaxBox.ExpandTabs="True"
syntax:SyntaxBox.AutoIndent="True"
syntax:SyntaxBox.ShowLineNumbers="True"
syntax:SyntaxBox.LineNumbersBackground="LightGray"
syntax:SyntaxBox.LineNumbersForeground="SlateGray"
AcceptsReturn="True"
AcceptsTab="True"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"
Padding="0,0,0,0"
FontFamily="Consolas"
FontSize="11pt">
<syntax:SyntaxBox.SyntaxDrivers>
<syntax:SyntaxConfig>
<syntax:KeywordRule Foreground="Blue"
Keywords="abstract,as,base,bool,break,byte,case,catch,char,checked,class,const,continue,decimal,default,delegate,do,double,else,enum,event,explicit,extern,false,finally,fixed,float,for,foreach,goto,if,implicit,in,int,interface,internal,is,lock,long,namespace,new,null,object,operator,out,override,params,private,protected,public,readonly,ref,return,sbyte,sealed,short,sizeof,stackalloc,static,string,struct,switch,this,throw,true,try,typeof,uint,ulong,unchecked,unsafe,ushort,using,using,static,virtual,void,volatile,while,get,set,yield,var"
/>
<syntax:KeywordRule Foreground="Purple"
Keywords="!,+,-,/,*,%,=,&,^,|,<,>"
WholeWordsOnly="False"
/>
<syntax:RegexRule Op="Line" Foreground="Gray" Pattern="^\s*#.*" />
<syntax:RegexRule Op="Line" Foreground="Maroon" Pattern=""(?:[^"\\]|\\.)*"" />
<syntax:RegexRule Op="Block" Foreground="Maroon" Pattern="@"(?:[^"])*"" />
<syntax:RegexRule Op="Line" Foreground="Green" Pattern="//.*" />
<syntax:RegexRule Op="Block" Foreground="Green" Pattern="(?m)/\*[^*]*\*+(?:[^\/*][^*]*\*+)*/" />
</syntax:SyntaxConfig>
</syntax:SyntaxBox.SyntaxDrivers>
</TextBox>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0-windows7.0
- Microsoft.CSharp (>= 4.7.0)
- System.Data.DataSetExtensions (>= 4.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 175 | 2/1/2025 |