Exemplo n.º 1
0
        protected StyleSheetCollection GetParentStyleSheets(object from)
        {
            StyleSheetCollection styleSheets = new StyleSheetCollection();

            if (from == null)
            {
                return(styleSheets);
            }

            var current = GetParent(from);

            while (current != null)
            {
                var styleSheet = GetStyleSheet(current);
                if (!ReferenceEquals(styleSheet, null))
                {
                    styleSheets.Add(styleSheet);
                }
                else if (current is IStyleSheetHolder styleSheetHolder)
                {
                    if (styleSheetHolder.AttachedStyleSheet != null)
                    {
                        styleSheets.Add(styleSheetHolder.AttachedStyleSheet);
                    }
                }
                current = GetParent(current);
            }

            return(styleSheets);
        }
Exemplo n.º 2
0
        private StyleSheetCollection UninitializeBaseStyleSheet(StyleSheetCollection styleSheetCollection)
        {
            if (styleSheetCollection == null)
            {
                return(null);
            }

            foreach (var added in styleSheetCollection)
            {
                added.PropertyChanged -= BaseStyleSheet_PropertyChanged;
            }

            styleSheetCollection.CollectionChanged -= BaseStyleSheets_CollectionChanged;

            return(styleSheetCollection);
        }
Exemplo n.º 3
0
        protected StyleSheetCollection GetParentStyleSheets(object from)
        {
            StyleSheetCollection styleSheets = new StyleSheetCollection();

            if (from == null)
            {
                return(styleSheets);
            }

            var current = GetParent(from);

            while (current != null)
            {
                var styleSheet = GetStyleSheet(current);
                if (styleSheet != null)
                {
                    styleSheets.Add(styleSheet);
                }
                current = GetParent(current);
            }

            return(styleSheets);
        }