Esempio 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);
        }
Esempio n. 2
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);
        }