private static void HandleSelectionChanged(object sender, RoutedEventArgs e)
        {
            var mathBox = (MathBox)sender;

            if (Equals(e.OriginalSource, sender))
            {
                TextPointer       caret             = mathBox.CaretPosition;
                InlineUIContainer forwardUiElement  = caret.GetAdjacentUIContainer(LogicalDirection.Forward);
                InlineUIContainer backwardUiElement = caret.GetAdjacentUIContainer(LogicalDirection.Backward);

                mathBox.ForwardUiElement  = forwardUiElement;
                mathBox.BackwardUiElement = backwardUiElement;
            }
        }