私は1つの方法を知っています...DispatcherTimer
うわーそれを避けてください:)INotifyPropertyChange
インターフェースはあなたの友達です。サンプルについては、msdnを参照してください。
基本的に、プロパティのイベント(通常はと呼ばれるonPropertyChanged
)を発生させSetter
、サブスクライバーがそれを処理します。
外出先からの実装例msdn
:
// This is a simple customer class that
// implements the IPropertyChange interface.
public class DemoCustomer : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String info)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
public string CustomerName
{
//getter
set
{
if (value != this.customerNameValue)
{
this.customerNameValue = value;
NotifyPropertyChanged("CustomerName");
}
}
}
}