protected override void SetValue(object obj, object value) { IObjectInstance objectInsance = obj as IObjectInstance; ObjectProperty property = objectInsance.LookupProperty(this); property.OnUserInput(value); }
protected override object GetValue(object obj) { IObjectInstance objectInsance = obj as IObjectInstance; ObjectProperty property = objectInsance.LookupProperty(this); return(property.Value); }
private ObjectProperty GetObjectProperty(object component) { // Find the object property. IObjectInstance objectInstance = ((IObjectInstance)component); ObjectProperty objectProperty = objectInstance.LookupProperty(this); return(objectProperty); }
public ObjectInstance(object wrappedObject, Dispatcher dispatcher) { _wrappedObject = wrappedObject; _dispatcher = dispatcher; // Create a wrapper around each property. _properties = _classInstance.ClassProperties.Select(p => ObjectProperty.From(this, p)).ToList(); }
public ObjectProperty LookupProperty(ClassProperty classProperty) { ObjectProperty objectProperty; if (!_properties.TryGetValue(classProperty, out objectProperty)) { objectProperty = ObjectProperty.From(this, classProperty); _properties.Add(classProperty, objectProperty); } return(objectProperty); }
// Called when the user edits the property. Sets the property in the wrapped object. private void OnPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { // Get the wrapped object. IObjectInstance objectInstance = (IObjectInstance)obj; object wrappedObject = objectInstance.WrappedObject; ObjectProperty objectProperty = objectInstance.LookupProperty(this); if (objectProperty != null) { // Set the property in the wrapped object. object value = obj.GetValue(_dependencyProperty); objectProperty.OnUserInput(value); } }
public ObjectInstance(TWrappedObjectType wrappedObject, Tree tree) { _wrappedObject = wrappedObject; _tree = tree; // Create a wrapper around each property. _properties = _classInstance.ClassProperties.Select(p => ObjectProperty.From(this, p)).ToList(); _depNodes = new Dependent(delegate { foreach (ObjectProperty property in _properties) { property.UpdateNodes(); } }); }
public ObjectProperty LookupProperty(CustomMemberProvider provider) { ObjectProperty dependentProperty; if (!_propertyByName.TryGetValue(provider, out dependentProperty)) { PropertyInfo propertyInfo = _wrappedObject.GetType().GetRuntimeProperty(provider.Name); if (propertyInfo == null) { return(null); } dependentProperty = new ObjectProperty(this, _wrappedObject, propertyInfo, provider); _propertyByName.Add(provider, dependentProperty); } return(dependentProperty); }
public object GetValue(object instance) { IObjectInstance obj = instance as IObjectInstance; if (obj == null) { return(null); } ObjectProperty property = obj.LookupProperty(this); if (property == null) { return(null); } return(property.GetValue()); }
public void SetValue(object instance, object value) { IObjectInstance obj = instance as IObjectInstance; if (obj == null) { return; } ObjectProperty property = obj.LookupProperty(this); if (property == null) { return; } property.SetValue(value); }
public virtual void UpdateValue(ObjectProperty property) { property.ContinueUpdateValue(); }
public virtual void SetValue(ObjectProperty property, object value) { property.ContinueSetValue(value); }
public virtual object GetValue(ObjectProperty property) { return property.ContinueGetValue(); }