Is it possible to attach behavior to all TextBoxes in Silverlight application?
I need to add simple functionality to all text boxes. (select all text on focus event)
void Target_GotFocus(object sender, System.Windows.RoutedEventArgs e)
{
Target.SelectAll();
}
You can override the default style for TextBoxes in your app. Then in this style, you can use some approach to apply a behavior with a setter (generally using attached properties).
It would something like this:
The behavior implementation:
And the attached property to help us apply the behavior: