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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:13:19+00:00 2026-05-16T15:13:19+00:00

I have a form with some validations set in entity metadata class. and then

  • 0

I have a form with some validations set in entity metadata class. and then binding entity instance to UI by VM. Something as below:

Xaml like:

   <Grid x:Name="LayoutRoot">
            <StackPanel VerticalAlignment="Top">
                <input:ValidationSummary />
            </StackPanel>
      <TextBox Text="{Binding Name, Mode=TwoWay}" />
      <ComboBox x:Name="xTest" ItemsSource="{Binding MyList}"
               SelectedItem="{Binding MyItem,Mode=TwoWay,
               DisplayMemberPath="MyName"
               ValidatesOnDataErrors=True,
               ValidatesOnNotifyDataErrors=True,
               ValidatesOnExceptions=True,
               NotifyOnValidationError=True,UpdateSourceTrigger=Explicit}"  />
      </Grid>

Code-behind like:

public MyForm()
{
  InitializeComponent();
  this.xTest.BindingValidationError +=new EventHandler<ValidationErrorEventArgs>((s,e)=>{

  BindingExpression be = this.xTest.GetBindingExpression(ComboBox.SelectedItemProperty);
  be.UpdateSource();

  if (e.Action == ValidationErrorEventAction.Added)
    ((ComboBox)s).Foreground = new SolidColorBrush(Colors.Red);
  });
}

Metadata like:

[Required]
 public string Name { get; set; }

 [RequiredAttribute]
 public int MyItemID { get; set; }

But when running the app, I got nothing display in valudationSummary.
For CombBox, even there is error, looks like BindingValidationError event is never fired.
How to resolve it?

  • 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-16T15:13:19+00:00Added an answer on May 16, 2026 at 3:13 pm

    Why are you using an Explicit UpdateSourceTrigger?

    Silverlight validation happens inside the binding framework, when the binding is updating the source object. The way you have this, there won’t be a binding validation error because you never tell the binding to update the source object. Well, actually you do, but it happens inside the validation error event handler. You’ve written chicken-and-egg code.

    • Remove your UpdateSourceTrigger on your binding or set it to Default.
    • Remove the explicit call to BindingExpression.UpdateSource.
    • Remove setting the ComboBox foreground to red – you are using NotifyOnValidationError=True, which eliminates any need to manually color the control.
    • Remove the DisplayMemberPath from the binding

    So your XAML:

    <Grid x:Name="LayoutRoot"> 
        <StackPanel VerticalAlignment="Top"> 
             <input:ValidationSummary /> 
             <ComboBox x:Name="xTest" ItemsSource="{Binding MyList}" 
                   SelectedItem="{Binding MyItem,
                   Mode=TwoWay, 
                   ValidatesOnDataErrors=True, 
                   ValidatesOnNotifyDataErrors=True, 
                   ValidatesOnExceptions=True, 
                   NotifyOnValidationError=True}"  /> 
          </StackPanel> 
    </Grid> 
    

    And your code:

    public MyForm()   
    {   
      InitializeComponent();   
      // you don't need anything here to have the validations work
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that uses ASP.NET validations. I am using some inline C#
I have a very basic form, with some very basic validations (though I need
I have a Zend_Form subclass. Some elements are set to belong to arrays. class
I have a form that submits to a third-party service that runs some validation.
I have a Django form that needs to do some client-side validation before submitting
I have the standard 'RequiredIf' attribute for some Conditional-Validation. My form and Model are
I apologize in advance, I am a PHP noob! I have form with some
I have a form with some ToolStrips, MenuStrips and a DataSet on it. Lately
I have next form and some ashx <form action=FileUpload.ashx method=POST enctype=multipart/form-data id=frmUpload> <input id=fileupload
I have a form with some input fields. I am using the tabStrip KendoUI

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.