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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:09:52+00:00 2026-05-25T15:09:52+00:00

So I have a WPF DataGrid , which is bound to an ObservableCollection .

  • 0

So I have a WPF DataGrid, which is bound to an ObservableCollection. The collection has validation on its members, through IDataErrorInfo. If I edit a cell in a way so as to be invalid, and then tab away from it before hitting enter, then come back and make it valid, the cell will stop showing invalid, however, the “!” at the head of the row will still be there, and the ToolTip will reference the previous, invalid value.

  • 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-25T15:09:53+00:00Added an answer on May 25, 2026 at 3:09 pm

    Not using Mode=TwoWay for DataGridTextColumns solves one version of the problem, however it seems that this problem can appear out of nowhere for other reasons as well.

    (Anyone who has a good explanation as of why not using Mode=TwoWay solves this in the first place is probably close to a solution to this problem)

    The same thing just happened to me with a DataGridComboBoxColumn so I tried to dig a little deeper.

    The problem isn’t the Binding in the Control that displays the ErrorTemplate inside DataGridHeaderBorder. It is binding its Visibility to Validation.HasError for the ancestor DataGridRow (exactly as it should be doing) and that part is working.

    Visibility="{Binding (Validation.HasError),
                         Converter={StaticResource bool2VisibilityConverter},
                         RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"/>
    

    The problem is that the validation error isn’t cleared from the DataGridRow once it is resolved. In my version of the problem, the DataGridRow started out with 0 errors. When I entered an invalid value it got 1 error so, so far so good. But when I resolved the error it jumped up to 3 errors, all of which were the same.

    Here I tried to resolve it with a DataTrigger that set the ValidationErrorTemplate to {x:Null} if Validation.Errors.Count wasn’t 1. It worked great for the first iteration but once I cleared the error for the second time it was back. It didn’t have 3 errors anymore, it had 7! After a couple of more iterations it was above 10.

    I also tried to clear the errors manually by doing UpdateSource and UpdateTarget on the BindingExpressions but no dice. Validation.ClearInvalid didn’t have any effect either. And looking through the source code in the Toolkit didn’t get me anywhere 🙂

    So I don’t have any good solutions to this but I thought I should post my findings anyway..

    My only “workaround” so far is to just hide the ErrorTemplate in the DataGridRowHeader

    <DataGrid ...>
        <DataGrid.RowStyle>
            <Style TargetType="DataGridRow">
                <Setter Property="ValidationErrorTemplate" Value="{x:Null}"/>
            </Style>
        </DataGrid.RowStyle>
        <!-- ... -->
    </DataGrid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have WPF ListBox which is bound to a ObservableCollection, when the collection changes,
I have a WPF DataGrid bound to ObservableCollection . Each item in my collection
I have a wpf datagrid which is bound to an observable collection. Currently I
I have a DataGrid in my WPF window which is bound to a database.
I have a WPF DataGrid which displays types that implement IDataErrorInfo. As expected when
I have a WPF DataGrid which has an AlternatingRowBackground brush. It's configured to color
I have WPF Form which has many buttons with the same code. Appearance of
I have a WPf Toolkit-datagrid..in my application which follows MVVM pattern. How I can
I have a WPF DataGrid bound to some entities (Entity Framework 4+). User then
Details VS-2008 Professional SP1 Version .net 3.5 Language:C# I have a WPF Datagrid which

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.