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

  • Home
  • SEARCH
  • 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 8309413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:06:30+00:00 2026-06-08T19:06:30+00:00

Silverlight validation using INotifyDataErrorInfo was working great with its slick error displays until I

  • 0

Silverlight validation using INotifyDataErrorInfo was working great with its slick error displays until I started trying to use it on TextBoxes that are bound to properties of non-string data-types. My plan was to use the setters of the properties to do the validation logic, adding and removing errors from there as necessary. It works great on TextBoxes that are strings, but if you have a TextBox bound to an Int and you enter a string, the setter doesn’t even get called (where I would be able to add an error that obviously non-numeric values are invalid). What is the suggested course of action from here? I’ve looked into ValueConverters, but they are too-far separated from the INotifyDataErrorInfo logic in my class that is being validated.

hypothetical example:

public class MyClass
{
    private string _prod;
    public string Prod
    {
        get { return _prod; }
        set //This works great
        {
            if (value.Length > 15)
            {
                AddError("Prod", "Cannot exceed 15 characters", false);
            }
            else if (value != _prod)
            {
                RemoveError("Prod", "Cannot exceed 15 characters");
                _prod= value;
            }
        }
    }

    private int _quantity;
    public int Quantity
    {
        get { return _quantity; }
        set //if a string was entered into the textbox, this setter is not called.
        {
            int test;
            if (!int.TryParse(value, test))
            {
                AddError("Quantity", "Must be numeric", false);
            }
            else if (test != _quantity)
            {
                RemoveError("Quantity", "Must be numeric");
                _quantity= test;
            }
        }
    }

    protected Dictionary<String, List<String>> errors = 
        new Dictionary<string, List<string>>();

    public void AddError(string propertyName, string error, bool isWarning)
    {
        //adds error to errors
    }
    public void RemoveError(string propertyName, string error)
    {
        //removes error from errors
    }

    //INotifyDataErrorInfo members...
}
  • 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-08T19:06:31+00:00Added an answer on June 8, 2026 at 7:06 pm

    I suggest you bind the value of the TextBox to a string value anyway and do the validation there.
    In case of a successful validation pass the value on to another property with the data type you are actually looking for (e.g. int). In any other case, fail the validation.
    Just a Workaround … but works for me.

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

Sidebar

Related Questions

I'm trying to implement binding validation using Silverlight on Windows Phone, but all I
I've heard (on a podcast) about using Silverlight to do client-side validation on an
I would like use data annotations to handle validation in my Silverlight app. The
Using Silverlight 4, Oracle 11g, and Entity Framework 4. I use a DataServiceQuery to
I'd like to use the built-in Silverlight 4.0 field validation on the following code,
Using the INotifyDataErrorInfo I have validation methods in my setters of my properties, this
I'm working on a Silverlight project with the WCF RIA Services beta. I'm using
In SilverLight Validation summary shows error in two parts one is data member name
I am currently trying to implement the built-in Silverlight 3 validation against objects that
While using the default validation handling in Silverlight ( using ValidatesOnExceptions=True,NotifyOnValidationError=True), you typically get

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.