Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8530793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:20:00+00:00 2026-06-11T09:20:00+00:00

I have a texbox with added dependency properties which enables me to add a

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:20:02+00:00Added an answer on June 11, 2026 at 9:20 am

    From code behind, you have to access it from the instance of your extended TextBox control, using the GetValue method:

    bool passRegexValue = (bool)MyTextBox.GetValue(ColorMasking.PassRegexProperty);
    

    (GetValue belongs to the underlying DependencyObject type.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have added the dependency property MyList to a wpf textbox. The dependency property
I have a textbox which I have added an attribute to using the following
I have a form in which there are textbox(s) added dynamically using jquery. The
I have a textbox which sends some commands to an instrument. I added the
I've recently added the JQuery autocomplete plug in and have a textbox that autocompletes
I have a textbox.In its onclick iam calling a javascript fn to call calendar.Texbox
I have: Textbox(Multi-line) Panel Different controls inside panel (buttons,textbox) Scenario: I need to add
I have TextBox (multiline) and Label in an UpdatePanel which I refresh with javascript
Desktop window application. I have textbox in which user give values in numbers. what
I have added a textbox, a dropdownlist, a checkbox, a button, and an update

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.