/// <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 and bottom. All we have to do is compress and extend the size, just like Measure. DataGrid dataGridOwner = DataGridOwner; bool horizontalLinesVisible = DataGridHelper.IsGridLineVisible(dataGridOwner, /*isHorizontal = */ true); bool verticalLinesVisible = DataGridHelper.IsGridLineVisible(dataGridOwner, /*isHorizontal = */ false); double horizontalLineThickness = 0; double verticalLineThickness = 0; if (horizontalLinesVisible) { horizontalLineThickness = dataGridOwner.HorizontalGridLineThickness; arrangeSize = DataGridHelper.SubtractFromSize(arrangeSize, horizontalLineThickness, /*height = */ true); } if (verticalLinesVisible) { verticalLineThickness = dataGridOwner.VerticalGridLineThickness; arrangeSize = DataGridHelper.SubtractFromSize(arrangeSize, verticalLineThickness, /*height = */ false); } Size returnSize = base.ArrangeOverride(arrangeSize); if (horizontalLinesVisible) { returnSize.Height += horizontalLineThickness; } if (verticalLinesVisible) { returnSize.Width += verticalLineThickness; } return(returnSize); }
/// <summary>Determines the final size and placement of the cell content.</summary> /// <param name="arrangeSize">The maximum size that the cell can occupy.</param> /// <returns>The final size of the control.</returns> // Token: 0x0600470A RID: 18186 RVA: 0x001421D4 File Offset: 0x001403D4 protected override Size ArrangeOverride(Size arrangeSize) { DataGrid dataGridOwner = this.DataGridOwner; bool flag = DataGridHelper.IsGridLineVisible(dataGridOwner, true); bool flag2 = DataGridHelper.IsGridLineVisible(dataGridOwner, false); double num = 0.0; double num2 = 0.0; if (flag) { num = dataGridOwner.HorizontalGridLineThickness; arrangeSize = DataGridHelper.SubtractFromSize(arrangeSize, num, true); } if (flag2) { num2 = dataGridOwner.VerticalGridLineThickness; arrangeSize = DataGridHelper.SubtractFromSize(arrangeSize, num2, false); } Size result = base.ArrangeOverride(arrangeSize); if (flag) { result.Height += num; } if (flag2) { result.Width += num2; } return(result); }
// 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 and bottom: // 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. DataGrid dataGridOwner = DataGridOwner; bool horizontalLinesVisible = DataGridHelper.IsGridLineVisible(dataGridOwner, /*isHorizontal = */ true); bool verticalLinesVisible = DataGridHelper.IsGridLineVisible(dataGridOwner, /*isHorizontal = */ false); double horizontalLineThickness = 0; double verticalLineThickness = 0; if (horizontalLinesVisible) { horizontalLineThickness = dataGridOwner.HorizontalGridLineThickness; constraint = DataGridHelper.SubtractFromSize(constraint, horizontalLineThickness, /*height = */ true); } if (verticalLinesVisible) { verticalLineThickness = dataGridOwner.VerticalGridLineThickness; constraint = DataGridHelper.SubtractFromSize(constraint, verticalLineThickness, /*height = */ false); } Size desiredSize = base.MeasureOverride(constraint); if (horizontalLinesVisible) { desiredSize.Height += horizontalLineThickness; } if (verticalLinesVisible) { desiredSize.Width += verticalLineThickness; } return(desiredSize); }