Open.Core.Helper.UnlistenPropertyChanged C# (CSharp) Method

UnlistenPropertyChanged() public static method

Casts the given object to an 'INotifyPropertyChanged' and if it is observable un-wires the given event handler from the 'PropertyChanged' event.
public static UnlistenPropertyChanged ( object model, PropertyChangedHandler handler ) : void
model object The model to un-wire.
handler PropertyChangedHandler The handler to remove.
return void
        public static void UnlistenPropertyChanged(object model, PropertyChangedHandler handler)
        {
            INotifyPropertyChanged observable = model as INotifyPropertyChanged;
            if (observable != null) observable.PropertyChanged -= handler;
        }
        #endregion