ページのビューモデルのプロパティの変更によってトリガーされるSilverlightの動作が必要です。しかし、これを行う方法がわかりません。
だから、私は非常に単純なビューモデルを持っています:
public class MyViewModel : INotifyPropertyChanged
{
private bool changingProperty;
public bool ChangingProperty
{
get { return changingProperty; }
set
{
if (changingProperty != value)
{
changingProperty = value;
NotifyPropertyChanged("ChangingProperty");
}
}
}
public string SomeProperty { get { return "SomePropertyValue"; } }
// INotifyPropertyChanged implementation here.......
}
このビューモデルは、テキストブロックが次の場所にバインドされているユーザーコントロールのデータコンテキストですSomeProperty
。
<TextBlock x:Key="myTextBlock" Text="{Binding SomeProperty}" />
これはすべて正常に機能します。ここで、ビューモデルのmyTextBlock
変更によってトリガーされるビヘイビアーをアタッチしたいと思います。動作は、たとえば(またはより洗練されたもの)ChangingProperty
を強調する必要があります。TextBlock
このトリガーを指定するにはどうすればよいですか?これは可能ですか?
敬具、
ロナルド