Beispiel #1
0
        internal void ListenPropertyChange(BindableProperty bindableProperty, PropertyChangedEventHandler eventHandler)
        {
            PropertyChangedListener propertyChangedListener;

            BindablePropertyChangedEventDict.TryGetValue(bindableProperty.PropertyName, out propertyChangedListener);

            if (null == propertyChangedListener)
            {
                propertyChangedListener = new PropertyChangedListener();
                BindablePropertyChangedEventDict.Add(bindableProperty.PropertyName, propertyChangedListener);
            }

            propertyChangedListener.RegisterListnerHandler(eventHandler);
        }
Beispiel #2
0
        internal void RemovePropertyChangeListener(BindableProperty bindableProperty, PropertyChangedEventHandler propertyChangedEventHandler)
        {
            PropertyChangedListener propertyChangedListener;

            BindablePropertyChangedEventDict.TryGetValue(bindableProperty.PropertyName, out propertyChangedListener);

            if (null != propertyChangedListener)
            {
                propertyChangedListener.UnRegisterListnerHandler(propertyChangedEventHandler);

                if (0 == propertyChangedListener.ListenerCount)
                {
                    BindablePropertyChangedEventDict.Remove(bindableProperty.PropertyName);
                }
            }
        }