protected override void ArrangeChildren(SizeF available) { int count = this.Children.Count; RectangleF buttonsClientRect = this.GetButtonsClientRect(available); float x = buttonsClientRect.X; float y = buttonsClientRect.Y; for (int index = 0; index < count; ++index) { if (this.Children[index] != this.buttonsPanel) { this.Children[index].Arrange(buttonsClientRect); } } SizeF desiredSize = this.buttonsPanel.DesiredSize; if (desiredSize == SizeF.Empty) { return; } Padding padding = this.RotatePadding(this.buttonsPanel.Margin); PageViewItemButtonsAlignment alignment = this.RotateButtonsAlignment(this.ButtonsAlignment); if (this.RightToLeft) { alignment = this.RTLTransformButtonsAlignment(alignment); } switch (alignment) { case PageViewItemButtonsAlignment.ButtonsBeforeContent: x = buttonsClientRect.X + (float)padding.Left; y = (float)((double)buttonsClientRect.Y + (double)padding.Top + ((double)buttonsClientRect.Height - (double)desiredSize.Height) / 2.0); break; case PageViewItemButtonsAlignment.ContentBeforeButtons: x = buttonsClientRect.Right - (float)padding.Right - desiredSize.Width; y = (float)((double)buttonsClientRect.Y + (double)padding.Top + ((double)buttonsClientRect.Height - (double)desiredSize.Height) / 2.0); break; case PageViewItemButtonsAlignment.ButtonsAboveContent: x = buttonsClientRect.X + (float)(((double)buttonsClientRect.Width - (double)desiredSize.Width) / 2.0) + (float)padding.Left; y = buttonsClientRect.Y + (float)padding.Top; break; case PageViewItemButtonsAlignment.ContentAboveButtons: x = buttonsClientRect.X + (float)(((double)buttonsClientRect.Width - (double)desiredSize.Width) / 2.0) + (float)padding.Left; y = buttonsClientRect.Bottom - (float)padding.Bottom - desiredSize.Height; break; } this.buttonsPanel.Arrange(new RectangleF(x, y, desiredSize.Width, desiredSize.Height)); }
protected override void ArrangeChildren(SizeF available) { SizeF desired = this.buttonsPanel.DesiredSize; if (desired == SizeF.Empty) { return; } RectangleF client = this.GetButtonsClientRect(available); float x = client.X; float y = client.Y; Padding margin = this.RotatePadding(this.buttonsPanel.Margin); PageViewItemButtonsAlignment alignment = this.RotateButtonsAlignment(this.ButtonsAlignment); if (this.RightToLeft) { alignment = this.RTLTransformButtonsAlignment(alignment); } switch (alignment) { case PageViewItemButtonsAlignment.ButtonsAboveContent: x = client.X + (client.Width - desired.Width) / 2 + margin.Left; y = client.Y + margin.Top; break; case PageViewItemButtonsAlignment.ContentAboveButtons: x = client.X + (client.Width - desired.Width) / 2 + margin.Left; y = client.Bottom - margin.Bottom - desired.Height; break; case PageViewItemButtonsAlignment.ButtonsBeforeContent: x = client.X + margin.Left; y = client.Y + margin.Top + (client.Height - desired.Height) / 2; break; case PageViewItemButtonsAlignment.ContentBeforeButtons: x = client.Right - margin.Right - desired.Width; y = client.Y + margin.Top + (client.Height - desired.Height) / 2; break; } this.buttonsPanel.Arrange(new RectangleF(x, y, desired.Width, desired.Height)); }
protected virtual PageViewItemButtonsAlignment RTLTransformButtonsAlignment(PageViewItemButtonsAlignment alignment) { switch (alignment) { case PageViewItemButtonsAlignment.ButtonsBeforeContent: alignment = PageViewItemButtonsAlignment.ContentBeforeButtons; break; case PageViewItemButtonsAlignment.ContentBeforeButtons: alignment = PageViewItemButtonsAlignment.ButtonsBeforeContent; break; case PageViewItemButtonsAlignment.ButtonsAboveContent: alignment = PageViewItemButtonsAlignment.ContentAboveButtons; break; case PageViewItemButtonsAlignment.ContentAboveButtons: alignment = PageViewItemButtonsAlignment.ButtonsAboveContent; break; } return(alignment); }
protected virtual PageViewItemButtonsAlignment RotateButtonsAlignment(PageViewItemButtonsAlignment alignment) { if (alignment == PageViewItemButtonsAlignment.Overlay) { return(alignment); } if (this.ContentOrientation == PageViewContentOrientation.Horizontal) { return(alignment); } switch (this.ContentOrientation) { case PageViewContentOrientation.Horizontal180: switch (alignment) { case PageViewItemButtonsAlignment.ButtonsAboveContent: alignment = PageViewItemButtonsAlignment.ContentAboveButtons; break; case PageViewItemButtonsAlignment.ContentAboveButtons: alignment = PageViewItemButtonsAlignment.ButtonsAboveContent; break; case PageViewItemButtonsAlignment.ButtonsBeforeContent: alignment = PageViewItemButtonsAlignment.ContentBeforeButtons; break; case PageViewItemButtonsAlignment.ContentBeforeButtons: alignment = PageViewItemButtonsAlignment.ButtonsBeforeContent; break; } break; case PageViewContentOrientation.Vertical90: switch (alignment) { case PageViewItemButtonsAlignment.ButtonsAboveContent: alignment = PageViewItemButtonsAlignment.ContentBeforeButtons; break; case PageViewItemButtonsAlignment.ButtonsBeforeContent: alignment = PageViewItemButtonsAlignment.ButtonsAboveContent; break; case PageViewItemButtonsAlignment.ContentAboveButtons: alignment = PageViewItemButtonsAlignment.ButtonsBeforeContent; break; case PageViewItemButtonsAlignment.ContentBeforeButtons: alignment = PageViewItemButtonsAlignment.ContentAboveButtons; break; } break; case PageViewContentOrientation.Vertical270: switch (alignment) { case PageViewItemButtonsAlignment.ButtonsAboveContent: alignment = PageViewItemButtonsAlignment.ButtonsBeforeContent; break; case PageViewItemButtonsAlignment.ButtonsBeforeContent: alignment = PageViewItemButtonsAlignment.ContentAboveButtons; break; case PageViewItemButtonsAlignment.ContentAboveButtons: alignment = PageViewItemButtonsAlignment.ContentBeforeButtons; break; case PageViewItemButtonsAlignment.ContentBeforeButtons: alignment = PageViewItemButtonsAlignment.ButtonsAboveContent; break; } break; } return(alignment); }