I have a texbox with added dependency properties which enables me to add a regex directly on the textbox and the textbox changes according if the regex has passed or failed. (How to define TextBox input restrictions? Nathan Tornquist post)
Now I want to add a property which I will update when the regex fails or not, so a boolean really.
I want that so that when I'm validating before adding new info into the database that all my new info passes their respective regex.
so basically I want to be able to do this
if(txtPostalCode.passRegex=true) Then
I have this so far added to the class
Public Shared ReadOnly PassRegexProperty As DependencyProperty = DependencyProperty.RegisterAttached("PassRegex", GetType(Boolean), GetType(ColorMasking), New PropertyMetadata(False))
Public Shared Sub SetPassRegex(obj As DependencyObject, PassRegex As Boolean)
obj.SetValue(PassRegexProperty, PassRegex)
End Sub
Public Shared Function GetPassRegex(obj As DependencyObject) As Boolean
Return DirectCast(obj.GetValue(PassRegexProperty), Boolean)
End Function
The property shows when in the xaml bit of the code, but if I'm in a module or something, how can I access this value?
I believe maybe I'm not using the right way, but I've been looking alot on google, and can't seem to find a good answer to point me in the good direction with this.
Any help or suggestions are appreciated.