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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:14:02+00:00 2026-05-27T09:14:02+00:00

I have a problem with validations between multiple fields. For example, I have a

  • 0

I have a problem with validations between multiple fields. For example, I have a ViewModel named RangeDateViewModel that contains 2 instances of a class named DateViewModel – they represent a start date and an end date respectively.

So my binding looks like this:

<TextBox Text="{Binding StartDate.Date, ValidateOnDataError=True}">
<TextBox Text="{Binding EndDate.Date, ValidateOnDataError=True}">

My RangeDateViewModel class implements the IDataErrorInfo interface.
In my plan, the RangeDateViewModel would validate that the start date is before the end date, by applying the validation logic in the IDataErrorInfo["propertyName"] function like this:

public string this[string columnName]
{
     get
     {
        return ValidationError();
     }
}

The problem is that this is never being called, and instead the IDataErrorInfo properties that reside in each of the DateViewModel classes are being called instead.

I guess this is because the bound property is not in the same level of RangeDateViewModel, but instead inside the child DateViewModel.

I think my need is quite basic and there must be an easy solution for this problem.

I tried using ValidationRules instead of IDataErrorInfo but then I’d problems letting the ViewModel know of the current validation status from the ValidationRules.

  • 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-05-27T09:14:03+00:00Added an answer on May 27, 2026 at 9:14 am

    Try using the following approach:

    1. Create a DataTemplate for DateViewModel:

      <DataTemplate DataType="{x:Type ViewModels:DateViewModel}">
          <TextBox Text="{Binding Date}">
      </DataTemplate>
      
    2. Bind the instances of this ViewModel to a ContentControl and set ValidateOnDataError to true on that binding:

      <ContentControl Content="{Binding StartDate, ValidateOnDataError=True}" />
      <ContentControl Content="{Binding EndDate, ValidateOnDataError=True}" />
      
    3. In RangeDateViewModel subscribe to the PropertyChanged event of StartDate and EndDate and when raised, raise a PropertyChanged event with StartDate / EndDate:

      StartDate.PropertyChanged += (s, e) => InvokePropertyChanged("StartDate");
      EndDate.PropertyChanged += (s, e) => InvokePropertyChanged("EndDate");
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, I have a class that has two strings, one of which must
I have problem in some JavaScript that I am writing where the Switch statement
There seems to be a problem between how PHP engine handles identical files that
There seems to be a problem between how PHP engine handles identical files that
I have a Class Library project which houses some shared code between other projects
I have a ValidationAttribute that I have created which is shared between the Server,
I have that text field: <input type='text' id='title' name='title'> <div id='error' class='error'></div> When user
I have a problem with validation messages not showing after a redirect, even when
Hey I have a problem with the validation and upload of apps to the
I am new to QTP and I have a problem with error validation message.

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.