コード例 #1
0
        /// <summary>
        /// Retrieves the specified trigger property if it exists; otherwise, creates the named trigger property and returns it.
        /// </summary>
        /// <typeparam name="T">The type of the property value.</typeparam>
        /// <param name="calculateInitialValue">The optional delegate that returns the initial value of the property.</param>
        /// <param name="comparer">The optional comparer used to determine when the value of the property has changed.</param>
        /// <param name="propertyName">The name of the property to retrieve or create.</param>
        public TriggerProperty <T> GetOrAddTriggerProperty <T>(Func <T> calculateInitialValue = null, IEqualityComparer <T> comparer = null, [CallerMemberName] string propertyName = null)
        {
            IProperty result;

            if (!_properties.TryGetValue(propertyName, out result))
            {
                result = new TriggerProperty <T>(_onPropertyChanged, calculateInitialValue == null ? default(T) : calculateInitialValue(), comparer);
                _properties.Add(propertyName, result);
            }

            return(result as TriggerProperty <T>);
        }
コード例 #2
0
 public DebugView(TriggerProperty <T> property)
 {
     _property = property;
     _base     = new SourcePropertyBase.DebugView(property);
 }