public override void Paste(XElement xe)
 {
     if (((EquationRow)ActiveChild).ActiveChild.GetType() == typeof(TextEquation) && xe.Name.LocalName == GetType().Name)
     {
         XElement children = xe.Element("ChildRows");
         List<EquationRow> newRows = new List<EquationRow>();
         foreach (XElement xElement in children.Elements())
         {
             EquationRow row = new EquationRow(this);
             row.DeSerialize(xElement);
             newRows.Add(row);
             row.FontSize = FontSize;
         }
         if (newRows.Count > 0)
         {
             TextEquation activeText = (TextEquation)((EquationRow)ActiveChild).ActiveChild;
             RowContainerPasteAction action = new RowContainerPasteAction(this)
             {
                 ActiveEquation = ActiveChild,
                 ActiveEquationSelectedItems = ActiveChild.SelectedItems,
                 ActiveEquationSelectionIndex = ActiveChild.SelectionStartIndex,
                 ActiveTextInChildRow = activeText,
                 TextEquationDecorations = activeText.GetDecorations(),
                 CaretIndexOfActiveText = activeText.CaretIndex,
                 TextEquationContents = activeText.Text,
                 TextEquationFormats = activeText.GetFormats(),
                 TextEquationModes = activeText.GetModes(),
                 SelectedItems = SelectedItems,
                 SelectionStartIndex = SelectionStartIndex,
                 SelectedItemsOfTextEquation = activeText.SelectedItems,
                 SelectionStartIndexOfTextEquation = activeText.SelectionStartIndex,
                 HeadTextOfPastedRows = newRows[0].GetFirstTextEquation().Text,
                 TailTextOfPastedRows = newRows.Last().GetLastTextEquation().Text,
                 HeadFormatsOfPastedRows = newRows[0].GetFirstTextEquation().GetFormats(),
                 TailFormatsOfPastedRows = newRows.Last().GetLastTextEquation().GetFormats(),
                 HeadModeOfPastedRows = newRows[0].GetFirstTextEquation().GetModes(),
                 TailModesOfPastedRows = newRows.Last().GetLastTextEquation().GetModes(),
                 HeadDecorationsOfPastedRows = newRows[0].GetFirstTextEquation().GetDecorations(),
                 TailDecorationsOfPastedRows = newRows.Last().GetLastTextEquation().GetDecorations(),
                 Equations = newRows
             };
             EquationRow newRow = (EquationRow)ActiveChild.Split(this);
             ((EquationRow)ActiveChild).Merge(newRows[0]);
             int index = childEquations.IndexOf(ActiveChild) + 1;
             childEquations.InsertRange(index, newRows.Skip(1));
             newRows.Last().Merge(newRow);
             newRows.Add(newRow);
             ActiveChild = childEquations[index + newRows.Count - 3];
             UndoManager.AddUndoAction(action);
         }
         CalculateSize();
     }
     else
     {
         base.Paste(xe);
     }
 }
 public override void DeSerialize(XElement xElement)
 {
     XElement children = xElement.Element("ChildRows");
     childEquations.Clear();
     foreach (XElement xe in children.Elements())
     {
         EquationRow row = new EquationRow(this);
         row.DeSerialize(xe);
         childEquations.Add(row);
     }
     if (childEquations.Count == 0)
     {
         childEquations.Add(new EquationRow(this));
     }
     ActiveChild = childEquations.First();
     CalculateSize();
 }