Replace class-based XAML converters with bound function converters #14186

Closed
opened 2026-01-31 04:03:17 +00:00 by claunia · 11 comments
Owner

Originally created by @DHowett on GitHub (Jun 9, 2021).

Originally assigned to: @marcelwgn on GitHub.

With the Settings UI, we have had an immense proliferation of class-based xaml converters.

They're pretty heavy, and they clutter the metadata with classes (and, well, clutter our build with idl files!). We also have to keep instances of them laying around for every xaml page that uses them.

We should instead bind more things with x:Bind Functions!

Proposal:

Introduce Microsoft.Terminal.Settings.Editor.Converters which has static conversion functions on it.
Use them exclusively in the settings editor.
Get rid of all the converter classes.

Evaluate the need for BindBack reverse converters. 😄

Originally created by @DHowett on GitHub (Jun 9, 2021). Originally assigned to: @marcelwgn on GitHub. With the Settings UI, we have had an immense proliferation of class-based xaml converters. They're pretty heavy, and they clutter the metadata with classes (and, well, clutter our build with idl files!). We also have to keep instances of them laying around for every xaml page that uses them. We should instead bind more things with [x:Bind Functions](https://docs.microsoft.com/en-us/windows/uwp/data-binding/function-bindings)! Proposal: Introduce `Microsoft.Terminal.Settings.Editor.Converters` which has static conversion functions on it. Use them exclusively in the settings editor. Get rid of all the converter classes. Evaluate the need for `BindBack` reverse converters. :smile:
Author
Owner

@DHowett commented on GitHub (Jun 9, 2021):

/cc @chingucoding 😄 since you asked!

@DHowett commented on GitHub (Jun 9, 2021): /cc @chingucoding :smile: since you asked!
Author
Owner

@marcelwgn commented on GitHub (Jun 9, 2021):

Awesome, thank you @DHowett !

@marcelwgn commented on GitHub (Jun 9, 2021): Awesome, thank you @DHowett !
Author
Owner

@marcelwgn commented on GitHub (Jun 9, 2021):

Out of curiosity, what is "blocking" this? Are there technical reasons or is it just that other things are more important than this?

@marcelwgn commented on GitHub (Jun 9, 2021): Out of curiosity, what is "blocking" this? Are there technical reasons or is it just that other things are more important than this?
Author
Owner

@DHowett commented on GitHub (Jun 9, 2021):

Nothing at all, just available developer time. 😄

We've got so much to do, and only so many hours in the work week.

@DHowett commented on GitHub (Jun 9, 2021): Nothing at all, just available developer time. :smile: We've got so much to do, and only so many hours in the work week.
Author
Owner

@marcelwgn commented on GitHub (Jun 9, 2021):

Ah haha I see, the classical developer problem! Good to know though that it's up for grabs then and not blocked by technical issues!

@marcelwgn commented on GitHub (Jun 9, 2021): Ah haha I see, the classical developer problem! Good to know though that it's up for grabs then and not blocked by technical issues!
Author
Owner

@DHowett commented on GitHub (Jun 10, 2021):

If you're interested in doing it, I'd be happy to assign you so that someone else doesn't come swoop in and do it! 😁

@DHowett commented on GitHub (Jun 10, 2021): If you're interested in doing it, I'd be happy to assign you so that someone else doesn't come swoop in and do it! 😁
Author
Owner

@marcelwgn commented on GitHub (Jun 10, 2021):

I currently have a lot of things on my plate, so I'm not sure when I would get to this. I'll let you know when I have more time and would be able to work this; if someone else wants to work on this, I don't want to block anyone here.

@marcelwgn commented on GitHub (Jun 10, 2021): I currently have a lot of things on my plate, so I'm not sure when I would get to this. I'll let you know when I have more time and would be able to work this; if someone else wants to work on this, I don't want to block anyone here.
Author
Owner

@marcelwgn commented on GitHub (Jul 11, 2021):

@DHowett I would like to take a look at this now, feel free to assign this to me :)

@marcelwgn commented on GitHub (Jul 11, 2021): @DHowett I would like to take a look at this now, feel free to assign this to me :)
Author
Owner

@DHowett commented on GitHub (Jul 11, 2021):

Awesome! Thanks :)

@DHowett commented on GitHub (Jul 11, 2021): Awesome! Thanks :)
Author
Owner

@marcelwgn commented on GitHub (Jul 17, 2021):

So after working on this and finally realizing how BindBack works, it seems that we will need to modify some models to provide a BindBack function. Is that fine behavior? In that case, should the converters reside in the Settings:Editor project and be shared to other projects?

@marcelwgn commented on GitHub (Jul 17, 2021): So after working on this and finally realizing how BindBack works, it seems that we will need to modify some models to provide a BindBack function. Is that fine behavior? In that case, should the converters reside in the Settings:Editor project and be shared to other projects?
Author
Owner

@ghost commented on GitHub (Aug 31, 2021):

:tada:This issue was addressed in #10846, which has now been successfully released as Windows Terminal Preview v1.11.2421.0.🎉

Handy links:

@ghost commented on GitHub (Aug 31, 2021): :tada:This issue was addressed in #10846, which has now been successfully released as `Windows Terminal Preview v1.11.2421.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.11.2421.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#14186