示例#1
0
 public static void VerifyReadOnlyKey(this IDependencyProperty dp, IDependencyPropertyKey key)
 {
     if (ReferenceEquals(dp, key.DependencyProperty))
     {
         throw new InvalidOperationException($"The provided key doesn't match property {dp.Name}");
     }
 }
        public IDependencyPropertyKey MakeReadOnly()
        {
            if (readOnlyKey != null)
            {
                throw new InvalidOperationException("The property is already read-only.");
            }

            readOnlyKey = new DependencyPropertyKey(this);
            return(readOnlyKey);
        }
 public void ClearValue(IDependencyPropertyKey key)
 {
     localStore.ClearValue(key.DependencyProperty);
 }
 public void SetValue(IDependencyPropertyKey key, object value)
 {
     localStore.SetValue(key.DependencyProperty, value);
 }
        public void OverrideMetadata(Type forType, IPropertyMetadata typeMetadata, IDependencyPropertyKey key)
        {
            this.VerifyReadOnlyKey(key);

            OverrideMetadataCommon(forType, typeMetadata);
        }
 public static void ClearValue(this IDependencyObject obj, IDependencyPropertyKey key)
 {
     obj.Component.ClearValue(key);
 }
 public static void SetValue(this IDependencyObject obj, IDependencyPropertyKey key, object value)
 {
     obj.Component.SetValue(key, value);
 }