简体   繁体   中英

Adding an extra property to WPF TextBox class

I a trying to change the TextBox wpf control so that it would include an extra property (a string). Is it possible to change an existing control? Would it be possible to create a new control that inherits from TextBox?

You cannot add an extra property to the TextBox control. You can however inherit from the TextBox control and make your own control. Add your extra properties in your custom control.

Having said that, if you have a single property that you require, you can always use the Tag property for your custom requirements.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM