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 8716349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:03:30+00:00 2026-06-13T06:03:30+00:00

Quick googling doesn’t yield a viable duplicate for this. I have what I hope

  • 0

Quick googling doesn’t yield a viable duplicate for this. I have what I hope is a pretty simple question about WPF error templates and/or the UpdateSourceTrigger property of a Binding. I’m kind of a WPF n00b so bear with me.

I can’t post code per se (work-related), but here’s the basic idea:

I have a standard set of a couple radio buttons in the same group. I have a text box “attached” to one of them, in the sense that TextBox.isEnabled is databound to rb.isChecked of one of the radio buttons.

The text box validates on data error, using PropertyChanged triggers. When an error occurs, it draws a red box around itself.

The problem I’m having is that “empty text box” is an error condition if and only if the radio button has enabled the text box. I need the error box to go away when I select the other radio button, but it doesn’t.

My first thought was to try to tie something in the error template to (HasError && IsEnabled) but I can’t see a clear way to do that.

I think that maybe triggering the TextBox (via UpdateSourceTrigger) on the FocusLost event in addition to PropertyChanged might work. Is there a way to do that?

Alternate solutions are welcome, of course.

  • 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-13T06:03:31+00:00Added an answer on June 13, 2026 at 6:03 am

    Validation will re-run whenever PropertyChanged is called. This means that you can force revalidation by raising the PropertyChanged event for the TextBox binding.

    Since you need to revalidate when the RadioButton.IsChecked changes you can raise PropertyChanged for the property that the TextBox is bound to on the setter for the property that the RadioButton is bound to.

    Example:

    class MyViewModel
    {
        public bool MyRadioButtonIsSelected
        {
           get { return myRadioButtonIsSelectedBacking; }
           set
           {
               myRadioButtonIsSelectedBacking= value;
               OnPropertyChanged("MyRadioButtonIsSelected");
    
               // Force revalidation of MyTextBoxValue
               OnPropertyChanged("MyTextBoxValue");
           }
        }
    
        public string MyTextBoxValue
        {
           get { return myTextBoxPropertyBackingField; }
           set
           {
               myTextBoxPropertyBackingField= value;
               OnPropertyChanged("MyTextBoxValue");
           }
        }
    }
    

    Xaml:

    <RadioButton
        Content="My Radio Button"
        IsChecked="{Binding MyRadioButtonIsSelected}" />
    <TextBox 
        IsEnabled="{Binding MyRadioButtonIsSelected}"
        Text="{Binding MyTextBoxValue, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Quick question. I have been Googling this all morning, but it's either not there,
Oddly enough, googling this error doesn't produce any results. Is there any quick fix
Quick question about WordPress. I've been Googling all over the place and cannot find
Quick question. Tried googling and SO and couldnt find anything like this. Is it
A quick question. Have done some googling, but still cannot find the answer: what
Quick question, I have the following string which is a coma separated list of
Quick question, indexof() find the first occur position of the string character? what about
Quick question (and sorry if it's already been asked, I have looked but couldn't
I've done some quick googling on the topic but couldn't find much information about
Quick question i imagine, but i'm having trouble getting a clear answer from googling.

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.