Esempio n. 1
0
        private void UpdateFromDataContext()
        {
            this.editingValue = this.DataContext as Microsoft.Windows.Design.PropertyEditing.PropertyValue;
            this.UnhookEditingProperty();
            if (this.editingValue != null)
            {
                this.editingProperty = (SceneNodeProperty)this.editingValue.ParentProperty;
            }
            if (this.editingProperty == null)
            {
                return;
            }
            SceneNodeObjectSet sceneNodeObjectSet = this.editingProperty.SceneNodeObjectSet;
            ReferenceStep      singleStep1        = (ReferenceStep)sceneNodeObjectSet.ProjectContext.ResolveProperty(BehaviorEventTriggerBaseNode.BehaviorSourceNameProperty);

            if (singleStep1 != null)
            {
                this.sourceNameProperty = sceneNodeObjectSet.CreateSceneNodeProperty(new PropertyReference(singleStep1), (AttributeCollection)null);
                this.sourceNameProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnSourceNameOrSourceObjectPropertyPropertyReferenceChanged);
            }
            ReferenceStep singleStep2 = (ReferenceStep)sceneNodeObjectSet.ProjectContext.ResolveProperty(BehaviorEventTriggerBaseNode.BehaviorSourceObjectProperty);

            if (singleStep2 != null)
            {
                this.sourceObjectProperty = sceneNodeObjectSet.CreateSceneNodeProperty(new PropertyReference(singleStep2), (AttributeCollection)null);
                this.sourceObjectProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnSourceNameOrSourceObjectPropertyPropertyReferenceChanged);
            }
            this.editingProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnEditingPropertyChanged);
            this.Rebuild();
        }
Esempio n. 2
0
        private void Rebuild()
        {
            PropertyValue             propertyValue     = this.DataContext as PropertyValue;
            PropertyReferenceProperty referenceProperty = (PropertyReferenceProperty)null;

            if (propertyValue != null)
            {
                referenceProperty = (PropertyReferenceProperty)propertyValue.get_ParentProperty();
            }
            if (referenceProperty == this.editingProperty)
            {
                return;
            }
            this.Unhook();
            this.editingProperty = referenceProperty;
            if (this.editingProperty == null)
            {
                return;
            }
            PropertyReference  reference          = this.editingProperty.Reference;
            SceneNodeObjectSet sceneNodeObjectSet = (SceneNodeObjectSet)this.editingProperty.ObjectSet;
            IPlatformMetadata  platformMetadata   = reference.PlatformMetadata;
            ReferenceStep      step1 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.TopProperty);
            ReferenceStep      step2 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.LeftProperty);
            ReferenceStep      step3 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.RightProperty);
            ReferenceStep      step4 = (ReferenceStep)platformMetadata.ResolveProperty(ThicknessNode.BottomProperty);
            Type runtimeType         = platformMetadata.ResolveType(PlatformTypes.Thickness).RuntimeType;

            this.top    = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step1), step1.Attributes);
            this.left   = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step2), step2.Attributes);
            this.right  = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step3), step3.Attributes);
            this.bottom = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step4), step4.Attributes);
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.left, "Left");
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.top, "Top");
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.right, "Right");
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.bottom, "Bottom");
            this.TopPropertyContainer.set_PropertyEntry((PropertyEntry)this.top);
            this.LeftPropertyContainer.set_PropertyEntry((PropertyEntry)this.left);
            this.RightPropertyContainer.set_PropertyEntry((PropertyEntry)this.right);
            this.BottomPropertyContainer.set_PropertyEntry((PropertyEntry)this.bottom);
        }
Esempio n. 3
0
        private void Rebuild()
        {
            PropertyValue             propertyValue     = this.DataContext as PropertyValue;
            PropertyReferenceProperty referenceProperty = (PropertyReferenceProperty)null;

            if (propertyValue != null)
            {
                referenceProperty = (PropertyReferenceProperty)propertyValue.get_ParentProperty();
            }
            if (referenceProperty == this.editingProperty)
            {
                return;
            }
            this.Unhook();
            this.editingProperty = referenceProperty;
            if (this.editingProperty == null)
            {
                return;
            }
            PropertyReference  reference          = this.editingProperty.Reference;
            SceneNodeObjectSet sceneNodeObjectSet = (SceneNodeObjectSet)this.editingProperty.ObjectSet;
            ITypeResolver      typeResolver       = (ITypeResolver)sceneNodeObjectSet.ProjectContext;

            ((PropertyEntry)this.editingProperty).get_PropertyType();
            IPropertyId propertyId1;
            IPropertyId propertyId2;

            if (PlatformTypes.Vector.IsAssignableFrom((ITypeId)this.editingProperty.PropertyTypeId))
            {
                propertyId1 = Point2DEditor.VectorXProperty;
                propertyId2 = Point2DEditor.VectorYProperty;
            }
            else if (PlatformTypes.Point.IsAssignableFrom((ITypeId)this.editingProperty.PropertyTypeId))
            {
                propertyId1 = Point2DEditor.PointXProperty;
                propertyId2 = Point2DEditor.PointYProperty;
            }
            else
            {
                Type nullableType = PlatformTypeHelper.GetNullableType(((PropertyEntry)this.editingProperty).get_PropertyType());
                if (nullableType == (Type)null)
                {
                    return;
                }
                IType type = typeResolver.GetType(nullableType);
                if (PlatformTypes.Vector.IsAssignableFrom((ITypeId)type))
                {
                    propertyId1 = Point2DEditor.VectorXProperty;
                    propertyId2 = Point2DEditor.VectorYProperty;
                }
                else
                {
                    if (!PlatformTypes.Point.IsAssignableFrom((ITypeId)type))
                    {
                        return;
                    }
                    propertyId1 = Point2DEditor.PointXProperty;
                    propertyId2 = Point2DEditor.PointYProperty;
                }
            }
            ReferenceStep step1 = (ReferenceStep)typeResolver.ResolveProperty(propertyId1);
            ReferenceStep step2 = (ReferenceStep)typeResolver.ResolveProperty(propertyId2);

            this.xProperty = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step1), step1.Attributes);
            this.yProperty = (PropertyReferenceProperty)sceneNodeObjectSet.CreateSceneNodeProperty(reference.Append(step2), step2.Attributes);
            this.XPropertyContainer.set_PropertyEntry((PropertyEntry)this.xProperty);
            this.YPropertyContainer.set_PropertyEntry((PropertyEntry)this.yProperty);
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.xProperty, "X");
            ValueEditorParameters.OverrideValueEditorParameters(this.editingProperty, this.yProperty, "Y");
        }