private double EnforceHardMaximumAndMinimum(double size)
        {
            SceneNodePropertyValue nodePropertyValue = this.DataContext as SceneNodePropertyValue;

            if (nodePropertyValue != null)
            {
                SceneNodeProperty sceneNodeProperty = nodePropertyValue.get_ParentProperty() as SceneNodeProperty;
                if (sceneNodeProperty != null && sceneNodeProperty.ValueEditorParameters != null)
                {
                    NumberRangesAttribute numberRangesAttribute = sceneNodeProperty.ValueEditorParameters["NumberRanges"] as NumberRangesAttribute;
                    if (numberRangesAttribute != null)
                    {
                        if (numberRangesAttribute.get_HardMaximum().HasValue&& numberRangesAttribute.get_HardMaximum().HasValue)
                        {
                            size = Math.Min(numberRangesAttribute.get_HardMaximum().Value, size);
                        }
                        if (numberRangesAttribute.get_HardMinimum().HasValue&& numberRangesAttribute.get_HardMinimum().HasValue)
                        {
                            size = Math.Max(numberRangesAttribute.get_HardMinimum().Value, size);
                        }
                    }
                }
            }
            return(size);
        }
        private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (this.parentProperty != null)
            {
                this.parentProperty.PropertyReferenceChanged -= new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnReferenceChanged);
            }
            SceneNodePropertyValue nodePropertyValue = this.DataContext as SceneNodePropertyValue;

            if (nodePropertyValue != null)
            {
                this.parentProperty = nodePropertyValue.get_ParentProperty() as SceneNodeProperty;
                this.parentProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnReferenceChanged);
            }
            this.Rebuild();
        }
Esempio n. 3
0
        private void Rebuild()
        {
            this.Unload();
            SceneNodePropertyValue nodePropertyValue = this.DataContext as SceneNodePropertyValue;

            if (nodePropertyValue == null)
            {
                return;
            }
            this.sceneNodeObjectSet  = ((SceneNodeProperty)nodePropertyValue.get_ParentProperty()).SceneNodeObjectSet;
            this.projectContext      = this.sceneNodeObjectSet.ProjectContext;
            this.projectFontFamilies = this.projectContext.ProjectFonts;
            this.projectFontFamilies.CollectionChanged += new NotifyCollectionChangedEventHandler(this.projectFontFamilies_CollectionChanged);
            this.fontFamilyEditor.FontFamilies          = FontFamilyValueEditor.GetFontFamilies(this.sceneNodeObjectSet);
            SelectedElementsObjectSet elementsObjectSet = this.sceneNodeObjectSet as SelectedElementsObjectSet;

            if (elementsObjectSet == null)
            {
                return;
            }
            elementsObjectSet.ViewModelChanged += new EventHandler(this.objectSet_ViewModelChanged);
        }
        private void Rebuild()
        {
            this.dataStorePropertiesValueProvider.Rebuild();
            SceneNodePropertyValue nodePropertyValue = this.DataContext as SceneNodePropertyValue;

            if (nodePropertyValue == null)
            {
                return;
            }
            string propertyName = (string)null;

            if (this.PropertyNameEntry != null && this.parentProperty != null && (this.parentProperty.SceneNodeObjectSet != null && this.parentProperty.SceneNodeObjectSet.RepresentativeNode != null))
            {
                IType     type = this.parentProperty.SceneNodeObjectSet.RepresentativeNode.Type;
                IProperty property;
                for (property = (IProperty)null; property == null && type != null; type = type.BaseType)
                {
                    property = type.GetMember(MemberType.LocalProperty, this.PropertyNameEntry, MemberAccessTypes.All) as IProperty;
                }
                if (property != null)
                {
                    propertyName = (string)this.parentProperty.SceneNodeObjectSet.RepresentativeSceneNode.GetLocalValue((IPropertyId)property);
                }
            }
            this.dataStorePropertiesValueProvider.EditingProperty = this.dataStorePropertiesValueProvider.FindMatchDataStorePropertyEntry(nodePropertyValue.get_ParentProperty() as SceneNodeProperty, propertyName);
            this.OnPropertyChanged("SelectedProperty");
        }
        private void Rebuild()
        {
            SceneNodePropertyValue nodePropertyValue = this.DataContext as SceneNodePropertyValue;

            if (nodePropertyValue == null)
            {
                return;
            }
            this.textAlignmentEditor.TextAlignments = this.GetTextAlignments((SceneNodeProperty)nodePropertyValue.get_ParentProperty());
        }