Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a (non MVVM) wpf system that displays various Db's (BankAccount, Customers etc) in separate viewer windows that use a Datagrid to access the data.

My problem is that some of these tables contain data that needs to be updated in more than one of the backing SQL tables. I know it shouldn't technically, but there are good reasons for this in this particular app.

For example, 2 of the tables contain a reference to the same Bank Account #, (which are used as keys), but there are cases where the user can want/need to change these particular values.

I am using ObervableCollections for the data read in from the tables, and these handle the updating in real time for the relevant "Main" table just fine, but I also need to update the same field in the other table.

Both tables are already loaded into their respective ObservableCollections. So I need a methodology to make the OnProertyChanged method update the secondary collection as well ?

I have tried various methods suggested across the Web, but cannot find a way to get this to occur automatically.

Can anyone help me out.

What I have tried:

My DataGrid columns are declared as shown here :

DataGridTextColumn Header="Bank #" Width="80"
SortMemberPath="BankNo"
Binding ="{Binding BankNo,
Mode=TwoWay,
UpdateSourceTrigger=LostFocus}"
Posted
Comments
[no name] 25-Mar-21 13:36pm    
What happens in an ObservableCollection and what happens in the "datbase layer" are 2 different things. I get the impression you don't really know how the DB gets updated; "main" table or otherwise.
Member 15074234 26-Mar-21 4:07am    
I admit I am new to this, coming from a background of 20 years writing (raw) "C" as per K&R :-))

So C# is newish to me, but I have written a couple of apps in C# that work just fine, but in WPF, I am hitting real problems as this shows.

That is why I am asking for help with "managing" Observable collections ??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900