Yes, one can further add to controls as they are just classes, like any other class. Create a new class and derive from TextBox
:
public class MyTextBox : TextBox
{
[Browsable(true)]
public string AllCapsText
=> Text.ToUpper();
}
Now textboxes of the MyTextBox
class will have the read-only property AllCapsText
ready to be used.
The Browsable
attribute you see there is one of the many things you can do to enhance the developer experience with your new component. In this case, we are making the property available for viewing in the Properties window of Visual Studio.