// ----------------------------------------------------------------- // Retrieve text properties from specified inline object. // // WORKAROUND: see PS task #13486 & #3399. // For inline object go to its parent and retrieve text decoration // properties from there. // ------------------------------------------------------------------ internal static TextDecorationCollection GetTextDecorationsForInlineObject(DependencyObject element, TextDecorationCollection textDecorations) { Debug.Assert(element != null); DependencyObject parent = LogicalTreeHelper.GetParent(element); TextDecorationCollection parentTextDecorations = null; if (parent != null) { // Get parent text decorations if it is non-null parentTextDecorations = GetTextDecorations(parent); } // see if the two text decorations are equal. bool textDecorationsEqual = (textDecorations == null) ? parentTextDecorations == null : textDecorations.ValueEquals(parentTextDecorations); if (!textDecorationsEqual) { if (parentTextDecorations == null) { textDecorations = null; } else { textDecorations = new TextDecorationCollection(); int count = parentTextDecorations.Count; for (int i = 0; i < count; ++i) { textDecorations.Add(parentTextDecorations[i]); } } } return textDecorations; }