Add new code sample for GUIConsole using WinUI 3 - Windows App SDK v1.1 #18310

Open
opened 2026-01-31 06:10:04 +00:00 by claunia · 5 comments
Owner

Originally created by @OculiViridi on GitHub (Aug 25, 2022).

Description of the new feature/enhancement

I'm creating a WinUI 3 Desktop application (using VS 2022 17.3 Blank App WinUI 3 in Desktop template) where I'd like to use the Windows Terminal API to create a terminal window control to use inside my application.

I started by looking at your GUIConsole.WPF sample that is written in WPF for .NET Framework 4.6.1.

I tried to port the classes and the XAML window but I'm not able to let it work. I still have errors both on XAML and on code.

Proposed technical implementation details

Can you please add a new version of the code sample that is written using the new Windows App SDK v1.1?

Originally created by @OculiViridi on GitHub (Aug 25, 2022). # Description of the new feature/enhancement I'm creating a WinUI 3 Desktop application (using VS 2022 17.3 **Blank App WinUI 3 in Desktop** template) where I'd like to use the Windows Terminal API to create a terminal window control to use inside my application. I started by looking at your [GUIConsole.WPF](https://github.com/microsoft/terminal/tree/main/samples/ConPTY/GUIConsole) sample that is written in WPF for .NET Framework 4.6.1. I tried to port the classes and the XAML window but I'm not able to let it work. I still have errors both on XAML and on code. # Proposed technical implementation details Can you please add a new version of the code sample that is written using the new Windows App SDK v1.1?
claunia added the Help WantedIssue-DocsProduct-MetaArea-TerminalControl labels 2026-01-31 06:10:04 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Aug 25, 2022):

Alrighty so there's kinda two separate bits here:

  • Create a version of the sample that uses WinUI3 & WASDK
  • Create a Terminal Control to use in a WASDK app

The first is probably a lot easier. The sample is mostly illustrative of the ConPTY APIs. All of the GUIConsole.ConPTY project should work the same in WASDK. The GUIConsole.WPF project is more of a placeholder app - it shows how to wire that up to some UI layer, but I'd never recommend anyone build production code on top of that. It's a viable place to start to understand the APIs, but appending lines to a text block is a terribly un-performant way of rendering text.

The second is... much harder. We do have a TermControl written for WinUI2 today. It's not ready for someone to take a dependency on it, for sure. I don't think we're doing anything MUX 2.x with it though, but there's definitely gaps before it's ready to be used in WinUI 3. We're tracking productizing that control in #6999.

I'll use this issue to track the first point. Thanks!

@zadjii-msft commented on GitHub (Aug 25, 2022): Alrighty so there's kinda two separate bits here: * Create a version of the sample that uses WinUI3 & WASDK * Create a Terminal Control to use in a WASDK app The first is probably a lot easier. The sample is mostly illustrative of the ConPTY APIs. All of the `GUIConsole.ConPTY` project should work the same in WASDK. The `GUIConsole.WPF` project is more of a placeholder app - it shows how to wire that up to _some_ UI layer, but I'd never recommend anyone build production code on top of that. It's a viable place to start to understand the APIs, but appending lines to a text block is a terribly un-performant way of rendering text. The second is... much harder. We do have a TermControl written for WinUI2 today. It's not ready for someone to take a dependency on it, for sure. I don't _think_ we're doing anything MUX 2.x with it though, but there's definitely gaps before it's ready to be used in WinUI 3. We're tracking productizing that control in #6999. I'll use this issue to track the first point. Thanks!
Author
Owner

@OculiViridi commented on GitHub (Aug 25, 2022):

Create a Terminal Control to use in a WASDK app

That would be AWESOME! ❤️

It is what I was looking for at the beginning of my project. But then, when I saw that the Windows Terminal also has APIs, I thought it might be worth a try and I find out the GUIConsole WPF sample.

...but I'd never recommend anyone build production code on top of that. It's a viable place to start to understand the APIs, but appending lines to a text block is a terribly un-performant way of rendering text.

Thanks for the hint!
Given this consideration, would it be possible to improve the code sample to let it use a better approach?

Thanks a lot!

@OculiViridi commented on GitHub (Aug 25, 2022): > Create a Terminal Control to use in a WASDK app That would be **AWESOME**! ❤️ It is what I was looking for at the beginning of my project. But then, when I saw that the Windows Terminal also has APIs, I thought it might be worth a try and I find out the GUIConsole WPF sample. > ...but I'd never recommend anyone build production code on top of that. It's a viable place to start to understand the APIs, but appending lines to a text block is a terribly un-performant way of rendering text. Thanks for the hint! Given this consideration, would it be possible to improve the code sample to let it use a better approach? Thanks a lot!
Author
Owner

@zadjii-msft commented on GitHub (Aug 25, 2022):

Given this consideration, would it be possible to improve the code sample to let it use a better approach

I mean, maybe? But the point of that sample isn't really an exercise in performant text rendering, it's more about "how do I use the conpty APIs in a WPF application". In that sense, the sample does quite well. We certainly don't have the bandwidth to optimize that sample farther, but I wouldn't reject PRs to it. I'd rather spend our efforts on the real solution. If you're serious about embedding a terminal control in your application, then #6999 is probably what you'd be more interested in.

@zadjii-msft commented on GitHub (Aug 25, 2022): > Given this consideration, would it be possible to improve the code sample to let it use a better approach I mean, maybe? But the point of that sample isn't really an exercise in performant text rendering, it's more about "how do I use the conpty APIs in a WPF application". In that sense, the sample does quite well. We certainly don't have the bandwidth to optimize that sample farther, but I wouldn't reject PRs to it. I'd rather spend our efforts on the real solution. If you're **serious** about embedding a terminal control in your application, then #6999 is probably what you'd be more interested in.
Author
Owner

@OculiViridi commented on GitHub (Jan 10, 2024):

@zadjii-msft Are there any news about those 2 arguments?

  1. Create a version of the sample that uses WinUI3 & WASDK
  2. Create a Terminal Control to use in a WASDK app
@OculiViridi commented on GitHub (Jan 10, 2024): @zadjii-msft Are there any news about those 2 arguments? > 1. Create a version of the sample that uses WinUI3 & WASDK > 2. Create a Terminal Control to use in a WASDK app
Author
Owner

@zadjii-msft commented on GitHub (Jan 10, 2024):

Nope, no progress on this front. EDIT: To clarify, this is in the Icebox, which basically means we don't expect the core team to ever have the resources to get around to this. We'd definitely accept community contributions though.

@zadjii-msft commented on GitHub (Jan 10, 2024): Nope, no progress on this front. EDIT: To clarify, this is in the Icebox, which basically means we don't expect the core team to _ever_ have the resources to get around to this. We'd definitely accept community contributions though.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18310