SilverlightShow: Tip: How to implement INotifyPropertyChanged interface? Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples en-us SilverlightShow.net estoychev@completit.com (Emil Stoychev) Argotic Syndication Framework, http://www.codeplex.com/Argotic http://www.rssboard.org/rss-specification RE: Tip: How to implement INotifyPropertyChanged interface? http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx#comment2822 Hi i have problem with using timer in my slApp, i have textbox and bind its text to property of object which is in page.datacontext <p>first time i see the value of this property, but if i try to change it in the method calld when timer elapsed, it isnt in textbox.</p>  public class vm<br />     {<br />         string s = "nejakyString";<br />         public event EventHandler SChanged;<br />         public string S<br />         {<br />             get { return s; }<br />             set { s = value; <br />                 raiseEventPropertyChanged("S"); <br />             }<br />         } public class vm<br />     {<br />         string s = "nejakyString";<br />         public event EventHandler SChanged;<br />         public string S<br />         {<br />             get { return s; }<br />             set { s = value; <br />                 raiseEventPropertyChanged("S"); <br />             }<br />         }<br /> public event PropertyChangedEventHandler PropertyChanged;<br />         private void raiseEventPropertyChanged(string propertyName)<br />         {<br />           if (PropertyChanged != null)<br />             {            <br />                 PropertyChanged(this, new PropertyChangedEventArgs(propertyName));<br />            } <p>Page.xaml.cs</p>             TimerCallback timerDelegate =<br />                 new TimerCallback(elapsed);<br /> <br />             vievModel = new vm();<br />             this.DataContext = vievModel; <p> </p>    public void elapsed(Object stateInfo)<br />     {vievModel.S += DateTime.Now.ToString();} <p>Page.xaml</p> <TextBox  Name="mujTextbox" Text="{Binding Path=S}" <p>thanks for helping me.</p> ( DanaH) http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx Tue, 22 Dec 2009 14:22:05 +0300 RE: Tip: How to implement INotifyPropertyChanged interface? http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx#comment2639 Nice addition Fizz, thanks :) ( iiordanov) http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx Sun, 08 Nov 2009 12:07:26 +0300 RE: Tip: How to implement INotifyPropertyChanged interface? http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx#comment2637 <p>Be Safe</p> <p><span style="color: #0000ff; font-size: 13px;">protected</span><span style="font-size: 13px;"> </span><span style="color: #0000ff; font-size: 13px;">virtual</span><span style="font-size: 13px;"> </span><span style="color: #0000ff; font-size: 13px;">void</span><span style="font-size: 13px;"> OnPropertyChanged(</span><span style="color: #2b91af; font-size: 13px;">PropertyChangedEventArgs</span><span style="font-size: 13px;"> e)<br /> {<br />     </span><span style="color: #2b91af; font-size: 13px;">PropertyChangedEventHandler</span><span style="font-size: 13px;"> eventHandler = </span><span style="color: #0000ff; font-size: 13px;">this</span><span style="font-size: 13px;">.PropertyChanged;<br />     </span><span style="color: #0000ff; font-size: 13px;">if</span><span style="font-size: 13px;"> (eventHandler != </span><span style="color: #0000ff; font-size: 13px;">null</span><span style="font-size: 13px;">)<br />     {<br />         eventHandler(</span><span style="color: #0000ff; font-size: 13px;">this</span><span style="font-size: 13px;">, e);<br />     }<br /> }</span></p> ( Fizz) http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx Sun, 08 Nov 2009 00:33:22 +0300 RE: Tip: How to implement INotifyPropertyChanged interface? http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx#comment2593 Is it possible to:<br /> define a class on my wcf-service with an INotifyPropertyChanged and then I contact the wcf-service with Silverlight and create a new instance of this class and then using a timer, I will update the information in this object using an Timer and when the information changes, the interface also changes automaticaly. Or is the INotifyPropertyChanged  propety not stirallizable? <p>Thanks</p> <br /> ( Huisman) http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx Wed, 28 Oct 2009 13:43:28 +0300 RE: Tip: How to implement INotifyPropertyChanged interface? http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx#comment2336 Awesome stuff man. Helped me a lot. Thanks ( Sriram) http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx Thu, 10 Sep 2009 08:38:43 +0300 RE: Tip: How to implement INotifyPropertyChanged interface? http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx#comment519 <p>If you define event this way:        </p> <p>public event PropertyChangedEventHandler PropertyChanged = delegate { };</p> <p>then you can remove the if-clause from OnPropertyChanged.</p> ( Tapani) http://www.silverlightshow.net/tips/How-to-implement-INotifyPropertyChanged-interface.aspx Wed, 08 Oct 2008 06:11:49 +0300