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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:00:10+00:00 2026-06-13T02:00:10+00:00

I have a question regarding WPF DataGrid. For the sake of IDataErrorInfo validation I

  • 0

I have a question regarding WPF DataGrid. For the sake of IDataErrorInfo validation I would like to set the entire selected row as editing – by that I mean setting every cell’s (in that row) data template from CellTemplate to CellEditingTemplate.

This is one column for example:

<DataGridTemplateColumn Header="Note">
    <DataGridTemplateColumn.CellEditingTemplate>
        <DataTemplate>                                    
            <TextBox Name="textBoxNote" Text="{Binding Note, ValidatesOnDataErrors=True}" />                                    
        </DataTemplate>
    </DataGridTemplateColumn.CellEditingTemplate>
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Note}" />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

Is that possible in XAML (triggers of some kind)? How would I do that in codebehind? I have found the solution with two separate styles as resources and then programamatically toggling between them in Row_Selected and Row_Unselected events, but I would rather use the existing above XAML code for columns (with separate CellTemplate and CellEditingTemplate).

Can anyone point me the right way?

Thanks in advance. Best regards,
DB

  • 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-13T02:00:11+00:00Added an answer on June 13, 2026 at 2:00 am

    Ok, I didn’t manage to put the whole row into edit mode, but I managed to revalidate the IDataErrorInfo object – kind of forced IDataErrorInfo validation. This was the reason for me wanting to set edit mode on all cells of the row – to bind controls from CellEditingTemplate to object properties with ValidateOnDataErrors = True. Otherwise I added new object to the DataGrid, but properties (except of the edited ones) never got validated.

    In the superclass of all of my model objects (that extends IDataErrorInfo) I added this method:

    public virtual void Revalidate() // never needed to override though
    {
        Type type = this.GetType();
    
        // "touch" all of the properties of the object - this calls the indexer that checks
        // if property is valid and sets the object's Error property 
        foreach (PropertyInfo propertyInfo in type.GetProperties())
        {                
            var indexerProperty = this[propertyInfo.Name];
        }
    }
    

    Now when the user adds new object to DataGrid I manually call myNewObject.Revalidate() method to set the Error property which I check before saving the object to the database.

    Thanks and regards,
    DB

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

Sidebar

Related Questions

I have a question regarding django templates and html frameset's. I would like to
I have one question regarding standard WPF DataGrid in .NET 4.0. When I try
I have a question regarding the MVVM design for C#/WPF. I've had a look
I have a question regarding how to best accomplish something in WPF MVVM. I
I am (very) new to WPF and I have got a question regarding that.
I am new to WPF and have a question regarding dispatcher and Delegate.Invoke .
Greetings I have a question regarding the combobox in WPF, let me sketch the
I have a question regarding WPF UserControls and MVVM Pattern, I need to expose
I have a question regarding the php validation, I have this script $(document).ready(function(){ //
I would have question regarding web services. Let's say I have webservice client that

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.