/// <summary>
 ///     Arrange.  This is overriden so that the cell can position its content to account for a grid line on the right.
 /// </summary>
 /// <param name="arrangeSize">Arrange size</param>
 protected override Size ArrangeOverride(Size arrangeSize)
 {
     // We don't need to adjust the Arrange position of the content.  By default it is arranged at 0,0 and we're
     // adding a line to the right.  All we have to do is compress and extend the size, just like Measure.
     if (DataGridHelper.IsGridLineVisible(DataGridOwner, /*isHorizontal = */ false))
     {
         double thickness  = DataGridOwner.VerticalGridLineThickness;
         Size   returnSize = base.ArrangeOverride(DataGridHelper.SubtractFromSize(arrangeSize, thickness, /*height = */ false));
         returnSize.Width += thickness;
         return(returnSize);
     }
     else
     {
         return(base.ArrangeOverride(arrangeSize));
     }
 }
        // Different parts of the DataGrid draw different pieces of the GridLines.
        // Cells draw a single line on their right side.

        /// <summary>
        ///     Measure.  This is overridden so that the cell can extend its size to account for a grid line on the right.
        /// </summary>
        protected override Size MeasureOverride(Size constraint)
        {
            // Make space for the GridLine on the right:
            // Remove space from the constraint (since it implicitly includes the GridLine's thickness),
            // call the base implementation, and add the thickness back for the returned size.
            if (DataGridHelper.IsGridLineVisible(DataGridOwner, /*isHorizontal = */ false))
            {
                double thickness   = DataGridOwner.VerticalGridLineThickness;
                Size   desiredSize = base.MeasureOverride(DataGridHelper.SubtractFromSize(constraint, thickness, /*height = */ false));
                desiredSize.Width += thickness;
                return(desiredSize);
            }
            else
            {
                return(base.MeasureOverride(constraint));
            }
        }