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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:46:50+00:00 2026-06-14T10:46:50+00:00

I have a datagrid, bound to a List: <DataGrid HorizontalAlignment=Left SelectedItem={Binding CurrentPlayer} Height=374 Margin=121,22,0,0

  • 0

I have a datagrid, bound to a List:

<DataGrid HorizontalAlignment="Left" SelectedItem="{Binding CurrentPlayer}" Height="374" Margin="121,22,0,0" RowHeaderWidth="0" VerticalAlignment="Top" Width="836" ItemsSource="{Binding Players}" AutoGenerateColumns="false" IsReadOnly="True" SelectionMode="Single" >

As you can see, when an item is selected, it’s stored in the CurrentPlayer property. The properties of that object are bound to textboxes where the user can edit the values.

The problem I have is: due to the binding, when the user edits the information (edits player name, address,..), the changes are immediatly shown in the datagrid, even when the user didn’t press the Save-button yet.

I don’t want that obviously as there’s also a cancel option and validation. I know you can bind one time or one way, but when the user DOES press the save button, the changes SHOULD show.

Is there any way to do this?

  • 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-14T10:46:51+00:00Added an answer on June 14, 2026 at 10:46 am

    One possible solution:

    have a baseclass for the viewmodel:

    class BaseClassViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
    
        protected void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                Debug.Print(info);
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }
    }
    

    Make each property for each field for the selected object a get set property in this form:

        public string FieldInObject
        {
            get
            {
                return _FieldInObject;
            }
            set
            {
                if (value != _FieldInObject)
                {
                    _FieldInObject = value;
                    //do not add this code here
                    //NotifyPropertyChanged("CurrentPlayer");
                }
            }
        }
    

    When the user presses the save button then use

    NotifyPropertyChanged("CurrentPlayer");
    NotifyPropertyChanged("<Property 1 in currentPlayer>"); 
     .....
    NotifyPropertyChanged("<Property n in currentPlayer");
    

    It should notify the WPF to update the CurrentPlayer.

    I hope this is somewhat understandable. Just use NotifyPropertyChanged to signal the WPF to update that field that is binded to that property.

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

Sidebar

Related Questions

I have a datagrid bound to a Players property: <DataGrid HorizontalAlignment=Left SelectedItem={Binding CurrentPlayer} Height=374
I have a windows form with DataBound DataGrid on it. Bound to a list
I have bound my datagrid to a list. I am following Repository pattern and
I have 2 silverlight controls on a form; datagrid which is bound to list
Picture the following scenario: I have a DataGrid which I've bound to a list
I have a list of object bound to a DataGrid in a WPF page
I have a dataGrid bound to a List object and this works fine by
I have a datagrid bound to a list of a custom model class. In
I have a WPF DataGrid. The DataGrid is bound to an IList. The list
I have a WPF datagrid, bound to a list populated by linq-to-sql from a

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.