I recently got a requirement that all the textboxes in my application should automatically trim the text when leaving the textbox. I can't/don't want to do this by adding converters or events to every single textbox, or by writing/rewriting the properties in my viewmodel for every single binding. First, it will be very messy and repetetive, second, I already have converters for many of my textboxes, and afaik, you can't connect multiple converters without writing a multiconverter.
Since you can't apply the trim at every key stroke, the trim must occur after the unfocus event but before the binding operation to my viewmodel.
What is the best way of doing this? Writing my own textbox class? Some kind of controltemplate/triggers? I'm not familiar enough with those options to know which path will be easiest.
I already have a style set up in App.xaml for all my textboxes which makes them look like IsEnabled=false when IsReadOnly is set to true, so that might complicate things.