Ejemplo n.º 1
0
 public static DependencyProperty Register(string name, Type properType, Type ownerType, object defaultValue)
 {
     DependencyProperty dp = new DependencyProperty(name, properType, ownerType, defaultValue)
     {
         Index = ++ globalIndex
     };
     RegisteredDps.Add(dp.HashCode, dp);
     return dp;
 }
Ejemplo n.º 2
0
 public void SetValue(DependencyProperty dp, object value)
 {
     EffectiveValueEntry effectiveValue = _effectiveValueEntries.FirstOrDefault((i) => i.PropertyIndex == dp.Index);
     if (effectiveValue != null && effectiveValue.PropertyIndex != 0)
         effectiveValue.Value = value;
     else
     {
         effectiveValue = new EffectiveValueEntry() {PropertyIndex = dp.Index, Value = value};
         _effectiveValueEntries.Add(effectiveValue);
         //DependencyProperty.RegisteredDps[dp.HashCode].Value = value;
     }
 }
Ejemplo n.º 3
0
        public object GetValue(DependencyProperty dp)
        {
            EffectiveValueEntry effectiveValue =
                _effectiveValueEntries.FirstOrDefault((i) => i.PropertyIndex == dp.Index);

            if (effectiveValue != null && effectiveValue.PropertyIndex != 0)
            {
                return effectiveValue.Value;
            } 

            PorpertypeMetadata metadata = DependencyProperty.RegisteredDps[dp.HashCode].GetMetadata(this.GetType());
            return metadata.Value;
        }