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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:53:40+00:00 2026-06-18T01:53:40+00:00

I have ObservableCollection<Customer> on my window. ObservableCollection<Customer> customers = new ObservableCollection<Customer>(); public ObservableCollection<Customer> Customers

  • 0

I have ObservableCollection<Customer> on my window.

ObservableCollection<Customer> customers = new ObservableCollection<Customer>();
public ObservableCollection<Customer> Customers { get { return customers; } set { customers = value; OnPropertyChanged("Customers"); } }  

This ObservableCollection has bound to ListView on the window. Once Use select on Customer from listView and click on edit a new window will appear with selected customer’s data.

Second window’s constructor

public EditCustomerWindow(Customer c)
{
    InitializeComponent();

    customerobj = c; //Original object
    tempCustomerobj = new Customer(c); //Getting a copy of the customer object

    CustomerDataGrid.DataContext = tempCustomerobj;
}  

Once user clicks on Save Button customer object will get updated and window will closes.

But my issue is ObserverCollection does not get update on fist window even though I set new edited customer object before editing window get closed. Cannot find what is the wrong I am doing. Please advice me.

customerobj = tempCustomerobj;
  • 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-18T01:53:41+00:00Added an answer on June 18, 2026 at 1:53 am

    You appear to be creating a new Customer object that is not in your ObservableCollection

    tempCustomerobj = new Customer(c);
    

    and then editing that new object.

    CustomerDataGrid.DataContext = tempCustomerobj;
    

    Doing that will not in any way affect the original Customer object that is still in your ObservableCollection.

    To solve, don’t create a new Customer, but rather edit an existing one.

    Update

    Based on your comments

    The line

    customerobj = c; //Original object
    

    causes customerobj to be an alias to c, your object that is actually in the ObservableCollection.

    The line

    customerobj = tempCustomerobj;
    

    causes customerobj to now be an alias to tempCustomerobj, which is your brand-new Customer object that is (I presume) a clone of c.

    Change your constructor to

    public EditCustomerWindow(Customer c)
    {
        InitializeComponent();
    
        CustomerDataGrid.DataContext = c;
    }  
    

    Update 2

    The object you’re editing should support IEditableObject. See

    https://stackoverflow.com/a/1091240/141172

    Alternatively, you can serialize the object before you start editing and deserialize the saved state if the edit is canceled.

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

Sidebar

Related Questions

I have a set of integers: public ObservableCollection<int> Scores = new ObservableCollection<int> { 10,
I have an ObservableCollection, this collection has 2 items (model), the model has Value
I have an ObservableCollection defined as public ObservableCollection<KeyValuePair<string, double>> comboBoxSelections { get; set; }
Suppose I have ObservableCollection of employee class public ObservableCollection<Employee> employeeCollection = new ObservableCollection<Employee>(); public
I have Observablecollection<A> aRef = new Observablecollection<A>(); bRef = aRef(); In this case both
I have an ObservableCollection<T> . T has a ToString() method. What I'd like to
I have an ObservableCollection of Task objects. Each Task has the following properties: AssignedTo
I have an instance of ObservableCollection bound to a WPF listbox with two separate
I have an ObservableCollection of class Customers that I fill from a database query.
I have ObservableCollection<ViewUnit> _myItems field, where ViewUnit implements INotifyPropertyChanged . ViewUnit has Handled :

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.