I’m working with Silverlight, how can I force all my textboxes to trim all leading and trailing whitespaces from their Text property in one place, say App.xaml or something else?
I don’t want to be setting an event handler for the GotFocus event every time I use a TextBox.
And I want to keep the ability to fully use xaml, for instance, If I create a new control that inherits from TextBox, then I’ll loose the xaml ability to set things declaratively.
It could be with behaviors, a global setter, or whatever action that allows me to keep using xaml and affect all textboxes.
You could create a behavior, but if I were you, I would create a new control that inherits from TextBox. You will not “lose xaml ability”.