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); }
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); }
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); }