Example #1
0
        private static void EnsureCoercionDataForProperty(DependencyObject d, DependencyProperty dp, object defaultBaseValue, out CoercionData cd, out CoercedPropertyInfo cpi)
        {
            cd  = GetCoercionData(d);
            cpi = null;
            if (cd == null)
            {
                cd = new CoercionData();
                SetCoercionData(d, cd);
            }
            else
            {
                cd.TryGetValue(dp, out cpi);
            }

            if (cpi == null)
            {
                cpi           = new CoercedPropertyInfo();
                cpi.BaseValue = defaultBaseValue;
                cd[dp]        = cpi;
            }
        }
Example #2
0
 /// <summary>
 /// Sets the CoercionData property. This dependency property
 /// is attached to any dependency object that contains coerced property values.
 /// </summary>
 private static void SetCoercionData(DependencyObject d, CoercionData value)
 {
     d.SetValue(CoercionDataProperty, value);
 }