MonoMobile.Views.MemberData.AddNotifyPropertyChangedHandler C# (CSharp) Method

AddNotifyPropertyChangedHandler() public method

public AddNotifyPropertyChangedHandler ( object value, IHandleNotifyPropertyChanged handler ) : void
value object
handler IHandleNotifyPropertyChanged
return void
		public void AddNotifyPropertyChangedHandler(object value, IHandleNotifyPropertyChanged handler)
		{
			RemoveNotifyPropertyChangedHandler(value, handler);
			var notifyPropertyChanged = value as INotifyPropertyChanged;
			if (notifyPropertyChanged != null && handler != null)
			{
				notifyPropertyChanged.PropertyChanged += handler.HandleNotifyPropertyChanged;
			}
		}
		

Usage Example

        protected virtual void SetDataContext(MemberData value)
        {
            if (_DataContext != value)
            {
                _DataContext = value;
                var newValue = _DataContext.Value;
                SetValue(newValue);
            }

            if (_DataContext != null)
            {
//				if (_DataContext.Source != null)
//					_DataContext.AddNotifyPropertyChangedHandler(_DataContext.Source, this);

                if (_DataContext.DataContextSource != null)
                {
                    _DataContext.AddNotifyPropertyChangedHandler(_DataContext.DataContextSource, this);
                }
            }
        }