// ------------------------------------------------------------------ // Retrieve background brush property from specified UIElement. // // position - Exact position of the content. // ------------------------------------------------------------------ internal static Brush GetBackgroundBrushForInlineObject(StaticTextPointer position) { object selected; Brush backgroundBrush; Debug.Assert(!position.IsNull); selected = position.TextContainer.Highlights.GetHighlightValue(position, LogicalDirection.Forward, typeof(TextSelection)); if (selected == DependencyProperty.UnsetValue) { backgroundBrush = (Brush)position.GetValue(TextElement.BackgroundProperty); } else { backgroundBrush = SelectionHighlightInfo.BackgroundBrush; } return backgroundBrush; }