public RadPropertyMetadata Copy(RadProperty dp) { RadPropertyMetadata instance = this.CreateInstance(); instance.InvokeMerge(this, dp); return(instance); }
public RadPropertyChangingEventArgs(RadProperty property, object oldValue, object newValue, RadPropertyMetadata metadata) { this.property = property; this.oldValue = oldValue; this.newValue = newValue; this.metadata = metadata; }
private static void ValidateMetadataDefaultValue(RadPropertyMetadata defaultMetadata, Type propertyType, ValidateValueCallback validateValueCallback) { /*if (defaultMetadata.DefaultValue != DefaultValueOptions.Instance) * { * RadProperty.ValidateDefaultValueCommon(defaultMetadata.DefaultValue, propertyType, validateValueCallback); * }*/ }
internal RadPropertyMetadata GetMetadata(RadObjectType type, out bool found) { RadPropertyMetadata metadata = this.GetMetadata(type); found = metadata != this._defaultMetadata; return(metadata); }
private void SetupOverrideMetadata(Type forType, RadPropertyMetadata typeMetadata, out RadObjectType dType, out RadPropertyMetadata baseMetadata) { if (forType == null) { throw new ArgumentNullException("forType"); } if (typeMetadata == null) { throw new ArgumentNullException("typeMetadata"); } if (typeMetadata.Sealed) { throw new ArgumentException(string.Format("TypeMetadataAlreadyInUse", new object[0])); } if (!typeof(RadObject).IsAssignableFrom(forType)) { object[] objArray1 = new object[] { forType.Name }; throw new ArgumentException(string.Format("TypeMustBeRadObjectDerived {0}", objArray1)); } if (typeMetadata.IsDefaultValueModified) { RadProperty.ValidateMetadataDefaultValue(typeMetadata, this.PropertyType, this.ValidateValueCallback); } dType = RadObjectType.FromSystemType(forType); baseMetadata = this.GetMetadata(dType.BaseType); if (!baseMetadata.GetType().IsAssignableFrom(typeMetadata.GetType())) { throw new ArgumentException(string.Format("OverridingMetadataDoesNotMatchBaseMetadataType", new object[0])); } }
public RadProperty AddOwner(Type ownerType, RadPropertyMetadata typeMetadata) { if (ownerType == null) { throw new ArgumentNullException("ownerType"); } if (this._defaultMetadata.ReadOnly && (this._defaultMetadata.AttachedPropertyUsage != AttachedPropertyUsage.Self)) { object[] objArray1 = new object[] { this.Name }; throw new InvalidOperationException(string.Format("Cannot Add Owner For Attached ReadOnly Property: {0}", objArray1)); } RadProperty.FromNameKey key1 = new RadProperty.FromNameKey(this.Name, ownerType); lock (RadProperty.Synchronized) { if (RadProperty.PropertyFromName.Contains(key1)) { object[] objArray2 = new object[] { this.Name, ownerType.Name }; throw new ArgumentException(string.Format("Property Already Registered {0}, {1}", objArray2)); } } if ((typeMetadata == null) && (this._defaultMetadata.AttachedPropertyUsage != AttachedPropertyUsage.Self)) { typeMetadata = this._defaultMetadata.Copy(this); } if (typeMetadata != null) { typeMetadata.SetAttachedPropertyUsage(AttachedPropertyUsage.Self); this.OverrideMetadata(ownerType, typeMetadata); } lock (RadProperty.Synchronized) { RadProperty.PropertyFromName[key1] = this; } return(this); }
internal void Dispose() { ++this.lockComposeCount; ++this.lockValueUpdateCount; if (this.owner != null) { this.owner.RemoveBinding(this); } if (this.boundObjects != null) { for (int index = this.boundObjects.Count - 1; index >= 0; --index) { PropertyBoundObject boundObject = this.boundObjects[index]; RadObject radObject = boundObject.Object; if (radObject != null && !radObject.IsDisposed && !radObject.IsDisposing) { int num = (int)radObject.UnbindProperty(boundObject.Property); } } this.boundObjects.Clear(); } this.property = (RadProperty)null; this.metadata = (RadPropertyMetadata)null; this.owner = (RadObject)null; this.propertyBinding = (PropertyBinding)null; this.animationSetting = (AnimatedPropertySetting)null; this.styleSetting = (IPropertySetting)null; }
public static RadProperty Register( string name, Type propertyType, Type ownerType, RadPropertyMetadata typeMetadata) { return(RadProperty.Register(name, propertyType, ownerType, typeMetadata, (ValidateValueCallback)null)); }
internal void InvokeMerge(RadPropertyMetadata baseMetadata, RadProperty dp) { if (baseMetadata.ReadOnly) { this._readOnlyKey = baseMetadata._readOnlyKey; } this.Merge(baseMetadata, dp); }
internal RadPropertyChangedEventArgs(RadProperty property, RadPropertyMetadata metadata, object oldValue, object newValue, bool isOldValueDeferred, bool isNewValueDeferred, ValueSource oldValueSource, ValueSource newValueSource) : this(property, metadata, oldValue, newValue) { this._isOldValueDeferred = isOldValueDeferred; this._isNewValueDeferred = isNewValueDeferred; this._oldValueSource = oldValueSource; this._newValueSource = newValueSource; }
internal RadPropertyChangedEventArgs( RadProperty property, RadPropertyMetadata metadata, object value) : this(property, metadata, value, value) { this._isASubPropertyChange = true; }
public RadPropertyChangedEventArgs( RadProperty property, RadPropertyMetadata metadata, object oldValue, object newValue) : this(property, oldValue, newValue) { this._metadata = metadata; }
protected override void Merge(RadPropertyMetadata baseMetadata, RadProperty dp) { base.Merge(baseMetadata, dp); //RadElementPropertyMetadata metadata = baseMetadata as RadElementPropertyMetadata; //if (metadata != null) //{ // this._options = metadata._options; //} }
public static RadProperty RegisterAttached( string name, Type propertyType, Type ownerType, RadPropertyMetadata typeMetadata, ValidateValueCallback validateValueCallback) { RadProperty.RegisterParameterValidation(name, propertyType, ownerType); return(RadProperty.RegisterCommon(name, propertyType, ownerType, AttachedPropertyUsage.Anywhere, typeMetadata, validateValueCallback)); }
public void OverrideMetadata(Type forType, RadPropertyMetadata typeMetadata) { RadObjectType type1; RadPropertyMetadata metadata1; this.SetupOverrideMetadata(forType, typeMetadata, out type1, out metadata1); if (metadata1.ReadOnly) { object[] objArray1 = new object[] { this.Name }; throw new InvalidOperationException(string.Format("ReadOnlyOverrideNotAllowed {0}", objArray1)); } this.ProcessOverrideMetadata(forType, typeMetadata, type1, metadata1); }
internal RadPropertyValue(RadObject owner, RadProperty property) { this.owner = owner; this.property = property; bool found; this.metadata = property.GetMetadata(this.owner.RadObjectType, out found); if (!found) { RadObjectType radObjectType = RadObjectType.FromSystemType(property.OwnerType); this.metadata = property.GetMetadata(radObjectType); } this.valueSource = ValueSource.Unknown; }
public void OverrideMetadata(Type forType, RadPropertyMetadata typeMetadata) { RadObjectType dType; RadPropertyMetadata baseMetadata; this.SetupOverrideMetadata(forType, typeMetadata, out dType, out baseMetadata); if (baseMetadata.ReadOnly) { throw new InvalidOperationException(string.Format("ReadOnlyOverrideNotAllowed {0}", new object[1] { (object)this.Name })); } this.ProcessOverrideMetadata(forType, typeMetadata, dType, baseMetadata); }
private RadProperty(string name, Type propertyType, Type ownerType, RadPropertyMetadata defaultMetadata, ValidateValueCallback validateValueCallback) { this._metadataMap = new InsertionSortMap(); this._name = name; this._propertyType = propertyType; this._ownerType = ownerType; this._defaultMetadata = defaultMetadata; this._validateValueCallback = validateValueCallback; lock (RadProperty.Synchronized) { this._globalIndex = RadProperty.GetUniqueGlobalIndex(ownerType, name); this.nameHashCode = name.GetHashCode(); RadProperty.RegisteredPropertyList.Add(this); } }
public static RadProperty Register(string name, Type propertyType, Type ownerType, RadPropertyMetadata typeMetadata, ValidateValueCallback validateValueCallback) { //RadProperty.RegisterParameterValidation(name, propertyType, ownerType); RadPropertyMetadata metadata1 = null; if ((typeMetadata != null) && typeMetadata.DefaultValueWasSet()) { metadata1 = new RadPropertyMetadata(typeMetadata.DefaultValue); } RadProperty property1 = RadProperty.RegisterCommon(name, propertyType, ownerType, AttachedPropertyUsage.Self, metadata1, validateValueCallback); if (typeMetadata != null) { property1.OverrideMetadata(ownerType, typeMetadata); } return(property1); }
private void ProcessOverrideMetadata(Type forType, RadPropertyMetadata typeMetadata, RadObjectType dType, RadPropertyMetadata baseMetadata) { lock (RadProperty.Synchronized) { if (RadProperty.UnsetValue == this._metadataMap[dType.Id]) { this._metadataMap[dType.Id] = typeMetadata; } else { object[] objArray1 = new object[] { forType.Name }; throw new ArgumentException(string.Format("TypeMetadataAlreadyRegistered {0}", objArray1)); } } typeMetadata.InvokeMerge(baseMetadata, this); typeMetadata.Seal(this, forType); }
public static RadProperty Register( string name, Type propertyType, Type ownerType, RadPropertyMetadata typeMetadata, ValidateValueCallback validateValueCallback) { RadPropertyMetadata defaultMetadata = (RadPropertyMetadata)null; if (typeMetadata != null && typeMetadata.DefaultValueWasSet()) { defaultMetadata = new RadPropertyMetadata(typeMetadata.DefaultValue); } RadProperty radProperty = RadProperty.RegisterCommon(name, propertyType, ownerType, AttachedPropertyUsage.Self, defaultMetadata, validateValueCallback); if (typeMetadata != null) { radProperty.OverrideMetadata(ownerType, typeMetadata); } return(radProperty); }
public RadProperty AddOwner(Type ownerType, RadPropertyMetadata typeMetadata) { if ((object)ownerType == null) { throw new ArgumentNullException(nameof(ownerType)); } if (this._defaultMetadata.ReadOnly && this._defaultMetadata.AttachedPropertyUsage != AttachedPropertyUsage.Self) { throw new InvalidOperationException(string.Format("Cannot Add Owner For Attached ReadOnly Property: {0}", new object[1] { (object)this.Name })); } RadProperty.FromNameKey fromNameKey = new RadProperty.FromNameKey(this.Name, ownerType); lock (RadProperty.Synchronized) { if (RadProperty.PropertyFromName.Contains((object)fromNameKey)) { throw new ArgumentException(string.Format("Property Already Registered {0}, {1}", new object[2] { (object)this.Name, (object)ownerType.Name })); } } if (typeMetadata == null && this._defaultMetadata.AttachedPropertyUsage != AttachedPropertyUsage.Self) { typeMetadata = this._defaultMetadata.Copy(this); } if (typeMetadata != null) { typeMetadata.SetAttachedPropertyUsage(AttachedPropertyUsage.Self); this.OverrideMetadata(ownerType, typeMetadata); } lock (RadProperty.Synchronized) RadProperty.PropertyFromName[(object)fromNameKey] = (object)this; return(this); }
protected virtual void Merge(RadPropertyMetadata baseMetadata, RadProperty dp) { if (baseMetadata == null) { throw new ArgumentNullException("baseMetadata"); } if (this.Sealed) { throw new InvalidOperationException(string.Format("TypeMetadataCannotChangeAfterUse", new object[0])); } if (!this.IsModified(1)) { this._defaultValue = baseMetadata.DefaultValue; } if (!this.IsModified(0x10)) { this._attachedPropertyUsage = baseMetadata.AttachedPropertyUsage; } if (baseMetadata.PropertyChangedCallback != null) { Delegate[] delegateArray1 = baseMetadata.PropertyChangedCallback.GetInvocationList(); if (delegateArray1.Length > 0) { PropertyChangedCallback callback1 = (PropertyChangedCallback)delegateArray1[0]; for (int num1 = 1; num1 < delegateArray1.Length; num1++) { callback1 = (PropertyChangedCallback)Delegate.Combine(callback1, (PropertyChangedCallback)delegateArray1[num1]); } callback1 = (PropertyChangedCallback)Delegate.Combine(callback1, this._propertyChangedCallback); this._propertyChangedCallback = callback1; } } if (this._coerceValueCallback == null) { this._coerceValueCallback = baseMetadata.CoerceValueCallback; } }
protected virtual void Merge(RadPropertyMetadata baseMetadata, RadProperty dp) { if (baseMetadata == null) { throw new ArgumentNullException(nameof(baseMetadata)); } if (this.Sealed) { throw new InvalidOperationException(string.Format("TypeMetadataCannotChangeAfterUse")); } if (!this.IsModified(1)) { this._defaultValue = baseMetadata.DefaultValue; } if (!this.IsModified(16)) { this._attachedPropertyUsage = baseMetadata.AttachedPropertyUsage; } if (baseMetadata.PropertyChangedCallback != null) { Delegate[] invocationList = baseMetadata.PropertyChangedCallback.GetInvocationList(); if (invocationList.Length > 0) { PropertyChangedCallback propertyChangedCallback = (PropertyChangedCallback)invocationList[0]; for (int index = 1; index < invocationList.Length; ++index) { propertyChangedCallback = (PropertyChangedCallback)Delegate.Combine((Delegate)propertyChangedCallback, invocationList[index]); } this._propertyChangedCallback = propertyChangedCallback + this._propertyChangedCallback; } } if (this._coerceValueCallback != null) { return; } this._coerceValueCallback = baseMetadata.CoerceValueCallback; }
private static RadProperty RegisterCommon( string name, Type propertyType, Type ownerType, AttachedPropertyUsage usage, RadPropertyMetadata defaultMetadata, ValidateValueCallback validateValueCallback) { RadProperty.FromNameKey fromNameKey = new RadProperty.FromNameKey(name, ownerType); lock (RadProperty.Synchronized) { if (RadProperty.PropertyFromName.Contains((object)fromNameKey)) { throw new ArgumentException(string.Format("Property already registered", new object[2] { (object)name, (object)ownerType.Name })); } } if (defaultMetadata == null) { defaultMetadata = RadProperty.AutoGeneratePropertyMetadata(propertyType, validateValueCallback, name, ownerType); } else if (!defaultMetadata.DefaultValueWasSet()) { defaultMetadata.DefaultValue = RadProperty.AutoGenerateDefaultValue(propertyType); } defaultMetadata.SetAttachedPropertyUsage(usage); RadProperty dp = new RadProperty(name, propertyType, ownerType, defaultMetadata, validateValueCallback); defaultMetadata.Seal(dp, (Type)null); lock (RadProperty.Synchronized) RadProperty.PropertyFromName[(object)fromNameKey] = (object)dp; return(dp); }
private static RadProperty RegisterCommon(string name, Type propertyType, Type ownerType, AttachedPropertyUsage usage, RadPropertyMetadata defaultMetadata, ValidateValueCallback validateValueCallback) { RadProperty.FromNameKey key1 = new RadProperty.FromNameKey(name, ownerType); lock (RadProperty.Synchronized) { if (RadProperty.PropertyFromName.Contains(key1)) { object[] objArray1 = new object[] { name, ownerType.Name }; throw new ArgumentException(string.Format("Property already registered", objArray1)); } } if (defaultMetadata == null) { defaultMetadata = RadProperty.AutoGeneratePropertyMetadata(propertyType, validateValueCallback, name, ownerType); } else { if (!defaultMetadata.DefaultValueWasSet()) { defaultMetadata.DefaultValue = RadProperty.AutoGenerateDefaultValue(propertyType); } //TODO: //RadProperty.ValidateMetadataDefaultValue(defaultMetadata, propertyType, validateValueCallback); } defaultMetadata.SetAttachedPropertyUsage(usage); RadProperty property1 = new RadProperty(name, propertyType, ownerType, defaultMetadata, validateValueCallback); defaultMetadata.Seal(property1, null); lock (RadProperty.Synchronized) { RadProperty.PropertyFromName[key1] = property1; } return(property1); }
internal RadPropertyMetadata Copy(RadProperty dp) { RadPropertyMetadata metadata1 = this.CreateInstance(); metadata1.InvokeMerge(this, dp); return metadata1; }
public static RadProperty RegisterAttached(string name, Type propertyType, Type ownerType, RadPropertyMetadata typeMetadata) { return(RadProperty.RegisterAttached(name, propertyType, ownerType, typeMetadata, null)); }
protected virtual bool IsPropertyCancelable(RadPropertyMetadata metadata) { return(false); }
private static void ValidateMetadataDefaultValue( RadPropertyMetadata defaultMetadata, Type propertyType, ValidateValueCallback validateValueCallback) { }