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 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 Rebuild()
        {
            SceneNodePropertyValue nodePropertyValue = this.DataContext as SceneNodePropertyValue;

            if (nodePropertyValue == null)
            {
                return;
            }
            this.textAlignmentEditor.TextAlignments = this.GetTextAlignments((SceneNodeProperty)nodePropertyValue.ParentProperty);
        }
Esempio n. 4
0
 public SceneNodePropertyCollection(SceneNodeProperty parentProperty, SceneNodePropertyValue parentValue)
     : base((PropertyValue)parentValue)
 {
     if (parentProperty == null)
     {
         throw new ArgumentNullException("parentProperty");
     }
     this.parentProperty = parentProperty;
     this.parentProperty.PropertyReferenceChanged += new Microsoft.Expression.DesignSurface.Documents.PropertyReferenceChangedEventHandler(this.OnPropertyReferenceChanged);
     this.objectSet = new SceneNodeCollectionObjectSet(this.parentProperty);
     this.Rebuild();
 }
        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();
        }
 protected override void Rebuild()
 {
     if (this.propertyValueCache == this.EditingValue)
     {
         return;
     }
     if (this.LayoutPathsView != null)
     {
         this.LayoutPathsView.CollectionChanged -= new NotifyCollectionChangedEventHandler(this.LayoutPathsView_CollectionChanged);
         this.LayoutPathsView.CurrentChanged    -= new EventHandler(this.LayoutPathsView_CurrentChanged);
     }
     this.propertyValueCache = this.EditingValue;
     this.currentIndex       = 0;
     this.LayoutPathsView    = CollectionViewSource.GetDefaultView((object)this.LayoutPaths);
     this.LayoutPathsView.CollectionChanged += new NotifyCollectionChangedEventHandler(this.LayoutPathsView_CollectionChanged);
     this.LayoutPathsView.CurrentChanged    += new EventHandler(this.LayoutPathsView_CurrentChanged);
     this.OnPropertyChanged("LayoutPathsView");
     this.OnPropertyChanged("HasLayoutPaths");
 }
        private void DeleteLayoutPath(object sender, RoutedEventArgs args)
        {
            SceneNodePropertyValue nodePropertyValue = ((FrameworkElement)sender).DataContext as SceneNodePropertyValue;

            if (nodePropertyValue == null || this.LayoutPaths == null || this.LayoutPaths.Count == 0)
            {
                return;
            }
            if (this.LayoutPathsView.CurrentItem as SceneNodePropertyValue == nodePropertyValue && this.LayoutPathsView.CurrentPosition == this.LayoutPaths.Count - 1)
            {
                this.currentIndex = Math.Max(0, this.LayoutPaths.Count - 2);
            }
            using (SceneEditTransaction editTransaction = this.ViewModel.CreateEditTransaction(StringTable.RemoveLayoutPathUndo))
            {
                using (this.ViewModel.ForceBaseValue())
                {
                    this.LayoutPaths.Remove((Microsoft.Windows.Design.PropertyEditing.PropertyValue)nodePropertyValue);
                    editTransaction.Commit();
                }
            }
        }
Esempio n. 8
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);
        }