Windows Phone 7 - TextBlock Text binding to ViewModel not returning anythinig -


i have built view model , listbox binds obervablecollection, textbox using temp url wont bind , return data. not getting errors either on compile or run

viewmodel:

public class homepagemodel:inotifypropertychanged {     public textblock bgrimg{get;set;}     public observablecollection<menuitem> menu {get; private set;}      public homepagemodel()     {         this.menu = new observablecollection<menuitem>();     }      public void load()     {         bgrimg = new textblock();         bgrimg.text = "/windows7mobileclient;component/images/desert.jpg";         //bgrimg = ;         menu.add(new menuitem("feed",""));         menu.add(new menuitem("messages",""));         menu.add(new menuitem("media",""));         menu.add(new menuitem("favourites",""));         menu.add(new menuitem("freinds",""));     }      public event propertychangedeventhandler propertychanged;     private void notifypropertychanged(string propertyname)     {         propertychangedeventhandler handler = propertychanged;         if (null != handler)         {             handler(this, new propertychangedeventargs(propertyname));         }     } } 

homepage.xaml

<controls:panoramaitem header="menu">             <grid>                 <textblock text="{binding bgrimg}"/>                 <listbox x:name="firstlistbox" margin="0,0,-12,0" itemssource="{binding menu}" mouseleftbuttonup="firstlistbox_mouseleftbuttonup" >                     <listbox.itemtemplate>                         <datatemplate>                             <stackpanel margin="0,0,0,17" width="432">                                 <textblock text="{binding label}" textwrapping="wrap" style="{staticresource phonetextextralargestyle}"/>                             </stackpanel>                         </datatemplate>                     </listbox.itemtemplate>                 </listbox>             </grid>         </controls:panoramaitem> 

i eventual want use string panorama background image. sorry if seems realy simply.

chris

you need call notifypropertychanged() in setters items wish bind to.


Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -