public virtual PropertyGridProperty CreateProperty(PropertyDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException("descriptor"); } bool forceReadWrite = false; PropertyGridProperty property = null; PropertyGridOptionsAttribute options = descriptor.GetAttribute <PropertyGridOptionsAttribute>(); if (options != null) { forceReadWrite = options.ForceReadWrite; if (options.PropertyType != null) { property = (PropertyGridProperty)Activator.CreateInstance(options.PropertyType, this); } } if (property == null) { options = descriptor.PropertyType.GetAttribute <PropertyGridOptionsAttribute>(); if (options != null) { if (!forceReadWrite) { forceReadWrite = options.ForceReadWrite; } if (options.PropertyType != null) { property = (PropertyGridProperty)Activator.CreateInstance(options.PropertyType, this); } } } if (property == null) { property = CreateProperty(); } Describe(property, descriptor); if (forceReadWrite) { property.IsReadOnly = false; } property.OnDescribed(); property.RefreshValueFromDescriptor(); return(property); }
protected virtual void OnSourcePropertyChanged(object sender, PropertyChangedEventArgs e) { if (e == null || e.PropertyName == null) { return; } PropertyGridProperty property = GetProperty(e.PropertyName); if (property != null) { property.RefreshValueFromDescriptor(); OnPropertyChanged(this, CreateEventArgs(property)); } }
protected virtual void OnSourcePropertyChanged(object sender, PropertyChangedEventArgs e) { if (e == null || e.PropertyName == null) { return; } PropertyGridProperty property = GetProperty(e.PropertyName); if (property != null) { bool forceRaise = false; var options = PropertyGridOptionsAttribute.FromProperty(property); if (options != null) { forceRaise = options.ForcePropertyChanged; } property.RefreshValueFromDescriptor(true, forceRaise, true); OnPropertyChanged(this, CreateEventArgs(property)); } }