c# - Databinding to Classmember of Classmember -


I need some help about WPF and Databinding.

Let's say I have Class A, Class B with one member. Classbie has a member again, perhaps an int:

  classbie {public ent member member of b. Set; }} Class A {Private Classbie _ The B; Public Class Membership {Get {return _theB;} set {_theB = value; // something needs to be done ...}}}  

When I have a databaying in XAMML:

    

Where the datacontax of the textbox is an object of class A.

As you can see, I have to do some computations in the member Offa Setter in class. But with the above database, this setter has never been called because it is connected to Classbie's member.

So, how can I inform that the member of the facade (when I write something in the text box)? Is there any best practice? (Code is not checked in Visual Studio, so there may be some syntax errors).

Thank you, Walter

The best way to handle this might be to INOptifyPropertyChanged B Will happen. When a new example of A to B is found, then hook it to the event (and if necessary, left of the old B event) if it is changed for the property.

  Public B-MemberOfa {get {return _b; } Set {if (_b! = Null) {_b.PropertyChanged - = B_PropertyChanged; } _b = value; If (_b! = Null) {_b.PropertyChanged + = B_PropertyChanged; } Whatever is (_b); }} Private Zero B_PropertyChanged (Object Sender, PropertyChangedEventArgs e) {DoHhatever ((B) Sender); }  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -