Beispiel #1
0
        public void UnapplyStyle()
        {
            if (this.stylesheetTree != null)
            {
                this.stylesheetTree.UnmapNodes();
            }

            this.styleRootElement.Style = null;
            this.stylesheetTree         = null;
        }
        public StylesheetTreeNode(StylesheetTree ownerTree, IElementSelector selector)
        {
            this.ownerTree = ownerTree;
            this.selector  = selector;
            this.nodes     = new StylesheetTreeNodeCollection(this);
            int selectorKey = 0;

            //Generally RootNode registers with
            if (selector != null)
            {
                selectorKey = selector.Key;
            }
            ownerTree.RegisterNodeWithKey(selectorKey, this);
        }
Beispiel #3
0
        private void ProcessStyle()
        {
            if (this.OwnerStyleManager != null && this.OwnerStyleManager.Owner != null)
            {
                XmlStyleRepository repository = ThemeResolutionService.GetThemeRepository(this.OwnerStyleManager.Owner.ThemeName);
                if (repository != null)
                {
                    this.styleSheet.ProcessGroupsInheritance(repository);
                }
            }

            this.stylesheetTree = new StylesheetTree(this);
            this.stylesheetTree.CreateNodesFromStyle(this.styleSheet);

            //Part of brute force algorithm test implemetation
            this.stylesheetTree.AttachElement(this.styleRootElement);
        }
        public void DetachElements()
        {
            if (this.mappedElements != null)
            {
                if (this.propertySettingGroups != null)
                {
                    foreach (NodeElementEntry elementEntry in this.mappedElements.Values)
                    {
                        this.ManagePropetyChangeSubscription(elementEntry, false);

                        for (int i = 0; i < this.propertySettingGroups.Count; i++)
                        {
                            foreach (IPropertySetting setting in this.propertySettingGroups[i].PropertySettings.EnumeratePropertySettingsForElement(elementEntry.Element))
                            {
                                setting.UnapplyValue(elementEntry.Element);

                                if (setting is AnimatedPropertySetting)
                                {
                                    elementEntry.Element.ResetValue(setting.Property, ValueResetFlags.Style);
                                }
                            }
                        }
                    }

                    this.propertySettingGroups.Clear();
                    this.propertySettingGroups = null;
                }

                this.mappedElements.Clear();
                this.mappedElements = null;
            }

            if (this.nodes != null)
            {
                foreach (StylesheetTreeNode node in this.nodes)
                {
                    node.DetachElements();
                }
                this.nodes.Clear();
                this.nodes = null;
            }

            this.ownerTree = null;
        }