windows phone 8.1 - MVVMLight: Xaml don't refresh when the viewmodel is updated -


i'm implementing wp8.1 project mvvmlight. in project, have multiple viewmodels (one features).

when ihm loading, binding viewmodels works fine.

but when click on ihm button in order refresh viewmodel (i use relaycommand), ihm don't refresh fields according viewmodels.

xaml code:

 <page x:class="applicationmobilewinphone.ihm.test" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:applicationmobilewinphone.ihm" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" background="{themeresource applicationpagebackgroundthemebrush}"  datacontext="{binding main, source={staticresource locator}}"> <grid>     <textbox foreground="black" x:name="textadress" text="{binding mytest.a}"  margin="0,40,0,0" ></textbox>     <button command="{binding mytest.searchcommand,  mode=onway}" content="ok"             commandparameter="{binding text, elementname=textadress}"             borderthickness="0" minheight="39" minwidth="39" x:name="buttonsearch" verticalalignment="bottom" height="50" width="32" margin="358,-9,0,593">      </button> </grid> 

viewmodels implementation:

public class mytest : viewmodelbase {     private relaycommand<string> _searchcommand;     private readonly inavigationservice _navigationservice;     public string     {         get;         set;     }     public mytest(inavigationservice nav)      {         _navigationservice = nav;         = "init";     }     public relaycommand<string> searchcommand     {                 {             return _searchcommand                    ?? (_searchcommand = new relaycommand<string>(                         =>                        {                            = "modify";                        }              ));         }     } } 

i don't understand because there other viewmodels , works fine.

you have call raisepropertychanged, not have implement it. add following line after assigning new value field:

... = "modify"; raisepropertychanged(() => a); ... 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -