public override void SetValue(object theObject, object theValue) { PropertyDescriptor descriptor; IVariablePropertiesCategorizedItem item = (IVariablePropertiesCategorizedItem)theObject; if (this.TryGetPropertyDescriptor(item, out descriptor)) { descriptor.SetValue(item.PropertyValueStore, theValue); } }
public override object GetValue(object theObject) { PropertyDescriptor descriptor; IVariablePropertiesCategorizedItem item = (IVariablePropertiesCategorizedItem)theObject; if (this.TryGetPropertyDescriptor(item, out descriptor)) { return(descriptor.GetValue(item.PropertyValueStore)); } return(null); }
private bool TryGetPropertyDescriptor(IVariablePropertiesCategorizedItem obj, out PropertyDescriptor propertyDescriptor) { try { propertyDescriptor = obj.GetPropertyDescriptorContainer().PropertyDescriptors[this.descriptor.Name]; } catch { propertyDescriptor = null; } return(propertyDescriptor != null); }