views:

221

answers:

2

Hi,

I have a piece of WPF/C# code that uses several Bindings:

  1. A combobox is used to select an Account
  2. The itemssource property of a second combobox is bound to the selected Account. This second combobox is used to select a Contact
  3. The itemssource property of a grid is bound to the selected Account. This grid contains the selected Account Invoices.
  4. The Contacts combobox parent DataContext is bound to the selected Invoice.
  5. The SelectedItem of the Contacts combobox is bound to the InvoiceContact property of the Invoice in the datacontext.

However the bindings are not updated in the order I want them to be. When I select another Account, the ItemsSource property of the Contact combobox change first, then it obviously change the SelectedItem, which changes the InvoiceContact and THEN, the selected Invoice changes...

No need to tell that it messes up the Invoice that was selected.

How can I control the order used to update the Bindings?

Thanks

Alex

A: 

Are you implementing INotifyPropertyChanged interface in your classes? I think the order is not so important if you implement INotifyPropertyChanged normally

ArsenMkrt
Well all the business objects are Entities and implement INotifyPropertyChange. As a workaround I set the critical bindings update trigger on Explicit, but there must be a more elegant way to do this.
alex
A: 

As I was about to write an answer (something with PropertyChanged...) I realized:
I don't have a clue on what you're trying.
So I painted your description...
I really don't know what your trying in steps 4 and 5. Maybe you could elaborate ?

Nils
Nice painting!The Contacts combobox is located in a grid that contains all the details for a given invoice. Thus the normal flow would be : Account -> Invoice -> Bill to ContactHowever the "Bill to" contact is an item in a combobox that contains all the contacts for the account. I thus need to load the contact list (the itemssource for this combobox) before the Invoice -> Bill to contact bindint is enforced.Does that make it clearer?
alex