Example #1
0
        public void AttachStylesToElementTree()
        {
            if (this.IsStylingSuspended)
            {
                return;
            }

            this.owner.ElementTree.SuspendAnimations();

            this.DetachStylesFromElementTree();

            this.state = StyleManagerState.Attaching;

            this.owner.ElementTree.AddElementPropertyChangeListener(this, RadElement.StyleProperty);

            this.MapStylesToElementsRecursive(owner.RootElement);

            this.owner.ElementTree.AddElementTreeChangeListener(this);
            this.owner.ElementTree.AddElementPropertyChangeListener(this, RadElement.ClassProperty);
            this.owner.ElementTree.AddElementPropertyChangeListener(this, RadItem.VisualStateProperty);

            this.state = StyleManagerState.Attached;

            this.owner.ElementTree.ResumeAnimations();
        }
Example #2
0
        public void DetachStylesFromElementTree()
        {
            if (this.state != StyleManagerState.Attached)
            {
                return;
            }

            this.state = StyleManagerState.Detaching;

            owner.ElementTree.RemoveElementTreeChangeListener(this);
            owner.ElementTree.RemoveElementPropertyChangeListener(this, RadElement.ClassProperty);
            owner.ElementTree.RemoveElementPropertyChangeListener(this, RadElement.StyleProperty);

            foreach (StyleMap styleMap in styleElementMap.Values)
            {
                styleMap.UnapplyStyle();
            }

            this.styleElementMap.Clear();

            this.state = StyleManagerState.Detached;
        }
Example #3
0
 public StyleManager(IComponentTreeHandler owner)
 {
     this.owner           = owner;
     this.state           = StyleManagerState.Initial;
     this.styleElementMap = new Dictionary <int, StyleMap>();
 }