Exemplo n.º 1
0
        public static bool IsDefaultValue(DocumentNode node)
        {
            DocumentCompositeNode documentCompositeNode = node as DocumentCompositeNode;

            if (documentCompositeNode != null)
            {
                return(documentCompositeNode.GetValue <bool>(DesignTimeProperties.IsDefaultStyleProperty));
            }
            return(StyleNode.IsReferenceValue(node));
        }
Exemplo n.º 2
0
        public virtual StyleNode ExpandDefaultStyle(IPropertyId propertyKey)
        {
            propertyKey = (IPropertyId)this.ProjectContext.ResolveProperty(propertyKey);
            if (this.IsSet(BaseFrameworkElement.StyleProperty) == PropertyState.Set)
            {
                return((StyleNode)null);
            }
            DocumentNode nodeForDefaultStyle = this.GetDocumentNodeForDefaultStyle(this.Type, propertyKey);
            StyleNode    styleNode1          = (StyleNode)null;

            if (nodeForDefaultStyle != null)
            {
                if (!StyleNode.IsReferenceValue(nodeForDefaultStyle))
                {
                    StyleNode styleNode2 = (StyleNode)this.ViewModel.GetSceneNode(nodeForDefaultStyle);
                    foreach (SetterSceneNode setter in (IEnumerable <SceneNode>)styleNode2.Setters)
                    {
                        DependencyPropertyReferenceStep property = setter.Property;
                        if (property != null && PlatformTypes.FrameworkTemplate.IsAssignableFrom((ITypeId)property.PropertyType))
                        {
                            this.ResolveTemplate(setter);
                        }
                    }
                    if (styleNode2.VisualTriggers != null)
                    {
                        foreach (TriggerBaseNode triggerBaseNode in (IEnumerable <TriggerBaseNode>)styleNode2.VisualTriggers)
                        {
                            BaseTriggerNode baseTriggerNode = triggerBaseNode as BaseTriggerNode;
                            if (baseTriggerNode != null)
                            {
                                foreach (SetterSceneNode setter in (IEnumerable <SceneNode>)baseTriggerNode.Setters)
                                {
                                    DependencyPropertyReferenceStep property = setter.Property;
                                    if (property != null && PlatformTypes.FrameworkTemplate.IsAssignableFrom((ITypeId)property.PropertyType))
                                    {
                                        this.ResolveTemplate(setter);
                                    }
                                }
                            }
                        }
                    }
                }
                styleNode1 = (StyleNode)this.ViewModel.GetSceneNode(nodeForDefaultStyle);
                using (this.ViewModel.ForceBaseValue())
                    this.SetValueAsSceneNode(propertyKey, (SceneNode)styleNode1);
            }
            return(styleNode1);
        }