コード例 #1
0
        public override void OnPropertyChange(RadElement element, RadPropertyChangedEventArgs e)
        {
            /*VisualElement visualElement = element as VisualElement;
             * if (visualElement == null)
             *  return;*/

            selector.Apply(element, propertySettings);
        }
コード例 #2
0
ファイル: StyleSheet.cs プロジェクト: configare/hispeed
        public void ApplyStyle(RadElement rootElement, bool isDynamicallyAddedElement)
        {
            //bool animationsEnabled = AnimatedPropertySetting.AnimationsEnabled;
            //AnimatedPropertySetting.AnimationsEnabled = false;

            //first should be applied selectors without any apply conditions
            LinkedList <NotAppliedSelector> selectorsWithConditions = new LinkedList <NotAppliedSelector>();

            for (int i = 0; i < this.PropertySettingGroups.Count; i++)
            {
                PropertySettingGroup group = this.PropertySettingGroups[i];
                for (int k = 0; k < group.Selectors.Count; k++)
                {
                    IElementSelector selector = group.Selectors[k];
                    //if (isDynamicallyAddedElement && selector is GeneralSelector)
                    //{
                    //    continue;
                    //}

                    if (selector.HasApplyCondition)
                    {
                        selectorsWithConditions.AddLast(new NotAppliedSelector(selector, group.PropertySettings));
                    }
                    else
                    {
                        //Selector selects internally all applicable elements
                        //selector.Apply(rootElement, group.PropertySettings);

                        LinkedList <RadElement> selectedElements = selector.GetSelectedElements(rootElement);
                        foreach (RadElement selected in selectedElements)
                        {
                            selector.Apply(selected, group.PropertySettings);
                        }
                    }
                }
            }

            foreach (NotAppliedSelector notApplied in selectorsWithConditions)
            {
                //Selector selects internally all applicable elements
                //notApplied.Selector.Apply(rootElement, notApplied.PropertySettings);
                foreach (RadElement selected in notApplied.Selector.GetSelectedElements(rootElement))
                {
                    notApplied.Selector.Apply(selected, notApplied.PropertySettings);
                }
            }

            //Temp optimization
            this.cachedChildrenHierarchyByElement.Clear();
        }