c# - How to Bind the the value of a TextBlock which is inside a DataTemplate? -
hi want bind value of textblock inside datatemplate text property of textblock change runtime according file/folder listing. have written below code string empty. working env windows phone 8 visual studio 2012.
<grid x:name="contentpanel"> <phone:longlistselector> <phone:longlistselector.listfootertemplate > <datatemplate > <textblock name="tbfooter" text="{binding footertext, mode=oneway}" /> </datatemplate> </phone:longlistselector.listfootertemplate> </phone:longlistselector>
this textblock name= tbfooter has updated runtime footertext value.
now in code behind have defined property
private int _footertext; public int footertext { { return this._footertext; } set { this._footertext=value notifypropertychanged("footertext"); } }
however value of teh textblock tbfooter null, not showing null. can me out please ?
edit: have again updated xaml code here,. don't follow mvvm here, simple windows phone apps. appreciated.
private int _footertext; public int footertext { { return this._footertext; } set { this._footertext=value; // <<-----------you might miss this! notifypropertychanged("footertext"); } }