Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you bind to a property on a reference object?
Message
De
21/07/2008 16:03:19
 
 
À
21/07/2008 15:29:45
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Divers
Thread ID:
01331472
Message ID:
01332944
Vues:
8
>I was hoping you would look into that case where you said you were successful at updating the foreign key field directly on the Job object, rather than updating the Customer object reference on the Job object, as seems to be the required way in Linq-to-Sql.

I have a number of times... I would like to know why it works too!!!! I still have no rational explanation for it.

>Is your data indeed Linq-to-Sql, where the Association attributes enforce this object-reference-foreign-key thing?

Yes, and I see no difference between here and other areas where it has not worked for me. I have to be missing something... I just don't have a clue what it is.

>Anway, I have found my next hurdle if you can think about it with me.... Please see screenshot at http://www.jordanmachine.com/ComboBox1.jpg
>
>You will see one Textbox bound to Job.cust_num and another bound to Job.Customer.custno. I did this just for testing.
>
>When I update the Customer object reference on the Job (via my John Fenton enabled ComboBox), the TextBox bound to Job.Customer.custno updates immediately, BUT the TextBox bound to Job.cust_num is not updating, even AFTER I do SubmitChanges(). I have to exit the form, and then come back, and then it is updated.
>
>>What's also weird is... To do some more testing, I added a Button to pop up a dialog to show Job.cust_num, and it is shows the correct value when I make a new selection in the ComboBox, even without doing a SubmitChanges.
>
>So the dialog will display the right data, but the bound textbox does not.
>
>Something to do with the notify stuff for sure.

SubmitChanges() isn't needed here so you are right it looks like a change notification issue. Are you binding TwoWay? If not try that first.

Linq2SQL implements INotifyPropertyChanged so if it is TwoWay... it should be working.

It does not implement INotifyCollectionChanged which can be a pain sometimes.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform