PropertyStatus enhancement - PropertyChanged routed eventPropertyStatus enhancement - PropertyChanged routed event
Old forum URL: forums.lhotka.net/forums/t/5799.aspx
ajj3085 posted on Thursday, November 13, 2008
Hi,
I've modified the PropertyStatus control to have a PropertyChanged routed event. I think this would help enable some useful things; my motivation was to run an animation ONLY when the BO property has changed. Here's the code:
private static readonly RoutedEvent PropertyChangedEvent =
EventManager.RegisterRoutedEvent(
"PropertyChanged",
RoutingStrategy.Bubble,
typeof( RoutedEventHandler ),
typeof( PropertyStatus )
);
public event RoutedEventHandler PropertyChanged {
add { AddHandler( PropertyChangedEvent, value ); }
remove { RemoveHandler( PropertyChangedEvent, value ); }
}
And then, the souce_PropertyChanged event handler looks like this:
if ( e.PropertyName == Property || string.IsNullOrEmpty( e.PropertyName ) ) {
UpdateState();
RaiseEvent( new RoutedEventArgs( PropertyChangedEvent, this ) );
}
Thanks!
Andy
Copyright (c) Marimer LLC