Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frozenassassine/textcontrolbox-winui
Winui3 textbox with syntax highlighting, line numbering and much more
https://github.com/frozenassassine/textcontrolbox-winui
csharp syntaxhighlighting textbox textcontrolbox winui3
Last synced: 8 days ago
JSON representation
Winui3 textbox with syntax highlighting, line numbering and much more
- Host: GitHub
- URL: https://github.com/frozenassassine/textcontrolbox-winui
- Owner: FrozenAssassine
- License: mit
- Created: 2023-07-31T20:45:48.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-11-28T21:33:16.000Z (12 months ago)
- Last Synced: 2024-11-01T23:05:59.504Z (19 days ago)
- Topics: csharp, syntaxhighlighting, textbox, textcontrolbox, winui3
- Language: C#
- Homepage:
- Size: 344 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
TextControlBox-WinUI
A textbox for WinUI3 with syntax highlighting, line numbering, and support for a large amount of text
## Reason why I built it
WinUI has a default Textbox and a RichTextBox. Both of them are very slow in rendering multiple thousand lines. The selection works also very slow. So I decided to create my own version of a Textbox.## Features:
- Viewing files with a million lines or more without performance issues
- Syntax highlighting
- Outstanding performance because it only renders the lines that are needed to display
- Line numbers
- Line highlighter
- Use JSON to create custom syntax highlighting
- Highly customizable## Problems:
- Current text limit is 100 million characters
- Currently, there is no text wrapping## Available languages:
- Batch
- Config file
- C++
- C#
- CSV
- CSS
- GCode
- Hex
- Html
- Java
- Javascript
- JSON
- Markdown
- LaTex
- PHP
- Python
- QSharp
- Toml
- XML## Create custom syntax highlighting languages with JSON:
```json
{
"Highlights": [
{
"CodeStyle": { //optional delete when not used
"Bold": true,
"Underlined": true,
"Italic": true
},
"Pattern": "REGEX PATTERN",
"ColorDark": "#ffffff", //color in dark theme
"ColorLight": "#000000" //color in light theme
},
],
"Name": "NAME",
"Filter": "EXTENSION1|EXTENSION2", //.cpp|.c
"Description": "DESCRIPTION",
"Author": "AUTHOR"
}
```### To bind it to the textbox you can use one of these ways:
```csTextControlBox textbox = new TextControlBox();
//Use a builtin language -> see list a bit higher
textbox.CodeLanguage = TextControlBox.GetCodeLanguageFromId(CodeLanguageId.CSharp");//Use a custom language:
var result = TextControlBox.GetCodeLanguageFromJson("JSON DATA");
if(result.Succeed)
textbox.CodeLanguage = result.CodeLanguage;
```## Create custom designs in C#:
```cs
textbox.Design = new TextControlBoxDesign(
new SolidColorBrush(Color.FromArgb(255, 30, 30, 30)), //Background brush
Color.FromArgb(255, 255, 255, 255), //Text color
Color.FromArgb(100, 0, 100, 255), //Selection color
Color.FromArgb(255, 255, 255, 255), //Cursor color
Color.FromArgb(50, 100, 100, 100), //Linehighlighter color
Color.FromArgb(255, 100, 100, 100), //Linenumber color
Color.FromArgb(0, 0, 0, 0), //Linenumber background
Color.FromArgb(100,255,150,0) //Search highlight color
);
```## Contributors:
If you want to contribute for this project, feel free to open an issue or a pull request.#