I have created an Extended TextBox
that Inherits a standard WPF TextBox
, what I am now trying to do is create other extended control types like a TextBlock
, ListBox
, ComboBox
etc. All controls will have the same DependencyProperties as shown below so I am trying to find a way to implement this without repeating the DependencyProperty
code behind each new extended control.
Public Class ExtendedTextBox
Inherits TextBox
Public Shared MandatoryProperty As DependencyProperty = DependencyProperty.Register("Mandatory", GetType(Boolean), GetType(ExtendedTextBox))
Public Shared ReadOnly HasAnyErrorsProperty As DependencyProperty = DependencyProperty.Register("HasAnyErrors", GetType(Boolean), GetType(ExtendedTextBox))
End Class
You could define attached properties that can be set on any
UIElement
:XAML: