Setting a global behavior for all textboxes in a Silverlight 5 app. RRS feed

  • Question

  • 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.

    Believe you can do it, and you will!!

    Tuesday, September 18, 2012 2:59 AM

All replies

  • I would like to know the same thing.
    Monday, February 25, 2013 10:52 PM