Ejemplo n.º 1
0
        private NodeElementEntry AddElementEntry(RadElement conditionCheckTargetElement, RadElement element)
        {
            if (this.mappedElements == null)
            {
                this.mappedElements = new StylesheetTreeNodeElementDictionary();
            }

            NodeElementEntry result = new NodeElementEntry(conditionCheckTargetElement, element, this);

            this.mappedElements[element] = result;

            return(result);
        }
Ejemplo n.º 2
0
        public void AttachElement(RadElement element)
        {
            if (this.propertySettingGroups == null || this.propertySettingGroups.Count == 0)
            {
                return;
            }

            this.ApplyPropertySettingsOnAttachedElement(element);
            if (!this.ContainsElement(element))
            {
                NodeElementEntry newElementEntry = AddElementEntry(null, element);
                this.ManagePropetyChangeSubscription(newElementEntry, true);
            }
        }
Ejemplo n.º 3
0
        public void AttachElementHierarchy(RadElement conditionCheckTargetElement, RadElement element)
        {
            foreach (RadElement radElement in ElementHierarchyEnumerator.TraverseElements(element))
            {
                if (this.CheckKey(radElement))
                {
                    this.EnsureElementsCreated();

                    NodeElementEntry newElementEntry = this.AddElementEntry(conditionCheckTargetElement, radElement);

                    AttachElementChildren(conditionCheckTargetElement, radElement);

                    this.ApplyPropertySettingsOnAttachedElement(radElement);
                    this.ManagePropetyChangeSubscription(newElementEntry, true);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Support for legacy "conditions" in themes.
        /// </summary>
        /// <param name="elementEntry"></param>
        /// <param name="subscribe"></param>
        private void ManagePropetyChangeSubscription(NodeElementEntry elementEntry, bool subscribe)
        {
            if (this.propertySettingGroups != null)
            {
                List <RadProperty> allProps = new List <RadProperty>();

                foreach (PropertySettingGroup group in this.propertySettingGroups)
                {
                    if (group.Selectors[0].HasApplyCondition)
                    {
                        group.Selectors[0].AddConditionPropertiesToList(allProps);
                    }
                }

                List <RadProperty> propsForSubscribtion = new List <RadProperty>();

                foreach (RadProperty prop in allProps)
                {
                    if (!propsForSubscribtion.Contains(prop))
                    {
                        propsForSubscribtion.Add(prop);
                    }
                }

                if (this.OwnerTree.OwnerStyleMap != null)
                {
                    foreach (RadProperty prop in propsForSubscribtion)
                    {
                        if (subscribe)
                        {
                            this.OwnerTree.OwnerStyleMap.OwnerStyleManager.Owner.ElementTree.SubscribeForElementPropertyChange(
                                elementEntry.OnRadPropertyChanged,
                                elementEntry.ConditionCheckTargetElement,
                                prop);
                        }
                        else
                        {
                            this.OwnerTree.OwnerStyleMap.OwnerStyleManager.Owner.ElementTree.UnsubscribeFromElementPropertyChange(
                                elementEntry.OnRadPropertyChanged,
                                elementEntry.ConditionCheckTargetElement,
                                prop);
                        }
                    }
                }
            }
        }