Example #1
0
        protected override void SetValue(object obj, object value)
        {
            IObjectInstance objectInsance = obj as IObjectInstance;
            ObjectProperty  property      = objectInsance.LookupProperty(this);

            property.OnUserInput(value);
        }
Example #2
0
        protected override object GetValue(object obj)
        {
            IObjectInstance objectInsance = obj as IObjectInstance;
            ObjectProperty  property      = objectInsance.LookupProperty(this);

            return(property.Value);
        }
Example #3
0
        public ObjectProperty LookupProperty(ClassProperty classProperty)
        {
            ObjectProperty objectProperty;

            if (!_properties.TryGetValue(classProperty, out objectProperty))
            {
                objectProperty = ObjectProperty.From(this, classProperty);
                _properties.Add(classProperty, objectProperty);
            }
            return(objectProperty);
        }
Example #4
0
        // 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);
            }
        }
Example #5
0
        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 Computed(delegate
            {
                foreach (ObjectProperty property in _properties)
                {
                    property.UpdateNodes();
                }
            });
        }