c# - Unable to correctly implement a binding between the property value of an object and the property value of a control -


i'm trying update textedit control through client class object databindings inotifypropertychanged implementation , can't work. object behind (datasource) updates textedit still remains blank. if type text editbox datasource gets updated. please? here's relevant code i'm using:

public class client : notifyproperychangedbase {      private string _firstname;     public string firstname     {                 {             return this._firstname;         }         set         {             this.checkpropertychanged<string>("firstname", ref _firstname, ref value);         }     } }   public client clienta = new client();  binding fname = new binding("text", clienta, "firstname", true, datasourceupdatemode.onpropertychanged);  ultratexteditor_firstname.databindings.add(fname); 

clienta.firstname = "testn"; <== editbox remains blank ...

am missing here? in advance, peter.

i assuming base implemented along lines of this example. if incorrect in assumption, need provide implementation of notifyproperychangedbase class.

you may want review binding(string, object, string, boolean, datasourceupdatemode) constructor documentation, discusses control events binding attempts locate.

looking @ example, want try this:

system.componentmodel.bindinglist<client> bindings = new system.componentmodel.bindinglist<client>();  client clienta = bindings.addnew(); clienta.firstname = "john";  texteditcontrol.datasource = bindings;  // change presumably refelected in control clienta.firstname = "jane"; 

update: after reviewing documentation on add method of controlbindingscollection class; believe data source of binding needs implement ilistsource interface in order participate in binding (all msdn examples dataset or datatable implement interface).


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -