WPF-UI.Terminal
1.0.38
dotnet add package WPF-UI.Terminal --version 1.0.38
NuGet\Install-Package WPF-UI.Terminal -Version 1.0.38
<PackageReference Include="WPF-UI.Terminal" Version="1.0.38" />
<PackageVersion Include="WPF-UI.Terminal" Version="1.0.38" />
<PackageReference Include="WPF-UI.Terminal" />
paket add WPF-UI.Terminal --version 1.0.38
#r "nuget: WPF-UI.Terminal, 1.0.38"
#:package WPF-UI.Terminal@1.0.38
#addin nuget:?package=WPF-UI.Terminal&version=1.0.38
#tool nuget:?package=WPF-UI.Terminal&version=1.0.38
WPF UI Terminal
WPF UI Terminal is a WPF terminal emulator control library that wraps Microsoft.Terminal.Wpf and Win32 ConPTY APIs to provide a fully-featured embedded terminal control for .NET / WPF applications.
Built on the shoulders of WPF UI, it integrates seamlessly with the Fluent design language.
Ported from EasyWindowsTerminalControl with added support for .NET Framework (net472, net48, net481).
🚀 Getting started
Install the NuGet package:
dotnet add package WPF-UI.Terminal
Add the terminal XML namespace to your XAML:
<Window xmlns:t="http://schemas.lepo.co/wpfui/2022/xaml/terminal">
Then place a TerminalControl anywhere in your UI:
<t:TerminalControl
StartupCommandLine="powershell.exe"
Theme="Dark"
FontFamilyWhenSettingTheme="Cascadia Code"
FontSizeWhenSettingTheme="12" />
👋 Controls
TerminalControl
The main WPF user control that hosts a full terminal emulator. It wraps Microsoft.Terminal.Wpf.TerminalControl and a TermPTY backend.
Properties:
| Property | Type | Description |
|---|---|---|
StartupCommandLine |
string |
Command to run on startup (default: powershell.exe) |
Theme (write-only) |
TerminalTheme? |
Sets the terminal color theme |
IsReadOnly (write-only) |
bool? |
When true, user cannot give input through the terminal UI |
IsCursorVisible (write-only) |
bool? |
Shows or hides the terminal cursor |
InputCapture |
INPUT_CAPTURE |
Flags to capture Tab / Direction keys inside the control |
Win32InputMode |
bool |
Enables extended key event handling (default: true) |
LogConPTYOutput |
bool |
Logs ConPTY output to a StringBuilder |
FontFamilyWhenSettingTheme |
FontFamily |
Font family applied when setting theme (default: Cascadia Code) |
FontSizeWhenSettingTheme |
int |
Font size applied when setting theme (default: 12) |
ConPTYTerm |
TermPTY |
The backend connection object |
Terminal (read-only) |
TerminalControl |
Direct access to the underlying Microsoft.Terminal.Wpf.TerminalControl |
Methods:
| Method | Description |
|---|---|
RestartTerm(TermPTY? useTerm, bool disposeOld) |
Restarts the terminal process |
DisconnectConPTYTerm() |
Disconnects and returns the current TermPTY |
TermPTY
Manages communication with the underlying console via a pseudo-console (ConPTY). Implements ITerminalConnection from Microsoft.Terminal.Wpf.
var term = new TermPTY();
term.Start("cmd.exe", 80, 30);
term.WriteToTerm("dir\r\n");
string output = term.GetConsoleText(stripVTCodes: true);
Members:
| Member | Description |
|---|---|
Start(command, width, height, logOutput, factory) |
Starts the pseudoconsole and child process |
WriteToTerm(input) |
Writes input (with VT-100 support) to the console |
WriteToTermBinary(input) |
Writes raw bytes to the console |
WriteToUITerminal(str) |
Simulates output from the program to the terminal window |
GetConsoleText(stripVTCodes) |
Returns the full console output log |
StripColors(str) |
Strips VT-100 escape codes from a string |
SetReadOnly(readOnly, updateCursor) |
Enables / disables read-only mode |
SetCursorVisibility(visible) |
Shows or hides the cursor |
ClearUITerminal(fullReset) |
Clears the terminal screen |
Resize(columns, rows) |
Resizes the pseudoconsole |
Win32DirectInputMode(enable) |
Toggles Win32 extended input mode |
CloseStdinToApp() |
Closes the input stream |
StopExternalTermOnly() |
Kills the child process |
InterceptOutputToUITerminal |
Delegate to intercept/modify output before it reaches the UI |
InterceptInputToTermApp |
Delegate to intercept/modify user input before it reaches the app |
TermReady |
Event fired when the console is ready |
TerminalOutput |
Event fired with terminal output data |
ReadDelimitedTermPTY
Extends TermPTY to buffer output and only send it to the UI after a specific delimiter string is seen. Useful for structured output (JSON, XML, custom terminators).
var term = new ReadDelimitedTermPTY(
delimiter: "\r\n",
MaxWaitTimeoutForDelimiter: TimeSpan.FromSeconds(5)
);
term.Start("my-cli-tool.exe");
term.SetReadOutputDelimiter("</output>",
TimeSpan.FromMilliseconds(500));
⚙️ XAML Namespace
xmlns:t="http://schemas.lepo.co/wpfui/2022/xaml/terminal"
Maps to Wpf.Ui.Terminal and Wpf.Ui.Terminal.Controls.
🏗️ Internals
The library provides extension points for advanced scenarios:
PseudoConsole- Wraps the Win32 Pseudo Console handle (Create,Resize)PseudoConsolePipe- Creates anonymous Win32 pipes for I/OPseudoConsoleApi- P/Invoke wrappers forconpty.dllProcessFactory- Static utility for starting child processes with pseudoconsole attributesIProcessFactory/IProcess- Interfaces for custom process creation (DI support)
🎯 Requirements
- Windows (terminal requires Win32 ConPTY support, available since Windows 10 v1809)
- .NET Framework 4.7.2+ / .NET 8.0+ / .NET 9.0+ / .NET 10.0+
📦 NuGet
WPF-UI.Terminal
https://www.nuget.org/packages/WPF-UI.Terminal
📄 License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net9.0-windows7.0 is compatible. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
| .NET Framework | net472 is compatible. net48 is compatible. net481 is compatible. |
-
.NETFramework 4.7.2
- CI.Microsoft.Terminal.Wpf (>= 1.22.250204002)
- CI.Microsoft.Windows.Console.ConPTY (>= 1.22.250314001)
- System.Memory (>= 4.6.3)
-
.NETFramework 4.8
- CI.Microsoft.Terminal.Wpf (>= 1.22.250204002)
- CI.Microsoft.Windows.Console.ConPTY (>= 1.22.250314001)
- System.Memory (>= 4.6.3)
-
.NETFramework 4.8.1
- CI.Microsoft.Terminal.Wpf (>= 1.22.250204002)
- CI.Microsoft.Windows.Console.ConPTY (>= 1.22.250314001)
- System.Memory (>= 4.6.3)
-
net10.0-windows7.0
- CI.Microsoft.Terminal.Wpf (>= 1.22.250204002)
- CI.Microsoft.Windows.Console.ConPTY (>= 1.22.250314001)
-
net8.0-windows7.0
- CI.Microsoft.Terminal.Wpf (>= 1.22.250204002)
- CI.Microsoft.Windows.Console.ConPTY (>= 1.22.250314001)
-
net9.0-windows7.0
- CI.Microsoft.Terminal.Wpf (>= 1.22.250204002)
- CI.Microsoft.Windows.Console.ConPTY (>= 1.22.250314001)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.