Hi,
I'd like to have a Silverlight behavior that is triggered by a change to a property in the view model for my page. I can't figure out how to do this, however.
So, I have a very simple view model:
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.......
}
This view model is the data context for a user control that has a text block bound to SomeProperty
:
<TextBlock x:Key="myTextBlock" Text="{Binding SomeProperty}" />
This all works fine. Now I'd like to attach a behavior to myTextBlock
that is triggered by changes to ChangingProperty
in my view model. The behavior should highlight the TextBlock
, for example (or something more sofisticated).
How do I specify this trigger? Is this possible at all?
Kind regards,
Ronald