c# - WPF - Bound Control Not Updating When Property Changed? -
i've bound text property of textbox base object's property , seems work fine. unfortunately, when programatically change value of property, doesn't seem update on gui.
here's property:
public string sealeddate { { string result = string.empty; if (_dacase.sealeddate != datetime.minvalue) { result = formatting.formatdate(_dacase.sealeddate); } return result; } set { datetime thedate = datetime.minvalue; if (datetime.tryparse(value, out thedate) && _dacase.sealeddate != thedate) { _dacase.sealeddate = thedate; base.onchanged(); //fires event know value of object has changed } } }
and value of property being set when property being set:
public bool issealed { { return _dacase.sealedid > 0 || _dacase.sealeddate != datetime.minvalue; } set { if (value != (_dacase.sealedid > 0 || _dacase.sealeddate != datetime.minvalue)) { if (value) { this.sealedid = authentication.currentuser.id; this.sealeddate = formatting.formatdate(datetime.now); } else { this.sealedid = 0; this.sealeddate = datetime.minvalue.tostring(); } base.onchanged(); } } }
and xaml of textbox isn't updating when think should:
<textbox name="txtsealeddate" text="{binding sealeddate}" grid.column="5" grid.row="3" isreadonly="true" />
vlad's solution (in comments) correct.
Comments
Post a Comment