Browse Source

Code was moved to MeasureCore.

pull/4/head
Steven Kirk 11 years ago
parent
commit
d9cd5ba3ab
  1. 57
      Perspex.Controls/Presenters/ContentPresenter.cs

57
Perspex.Controls/Presenters/ContentPresenter.cs

@ -61,63 +61,6 @@ namespace Perspex.Controls.Presenters
}
}
protected override Size ArrangeOverride(Size finalSize)
{
Control child = ((IVisual)this).VisualChildren.SingleOrDefault() as Control;
if (child != null)
{
double left;
double top;
double width;
double height;
switch (child.HorizontalAlignment)
{
case HorizontalAlignment.Left:
left = 0;
width = child.DesiredSize.Value.Width;
break;
case HorizontalAlignment.Center:
left = (finalSize.Width / 2) - (child.DesiredSize.Value.Width / 2);
width = child.DesiredSize.Value.Width;
break;
case HorizontalAlignment.Right:
left = finalSize.Width - child.DesiredSize.Value.Width;
width = child.DesiredSize.Value.Width;
break;
default:
left = 0;
width = finalSize.Width;
break;
}
switch (child.VerticalAlignment)
{
case VerticalAlignment.Top:
top = 0;
height = child.DesiredSize.Value.Height;
break;
case VerticalAlignment.Center:
top = (finalSize.Height / 2) - (child.DesiredSize.Value.Height / 2);
height = child.DesiredSize.Value.Height;
break;
case VerticalAlignment.Bottom:
top = finalSize.Height - child.DesiredSize.Value.Height;
height = child.DesiredSize.Value.Height;
break;
default:
top = 0;
height = finalSize.Height;
break;
}
child.Arrange(new Rect(left, top, width, height));
}
return finalSize;
}
protected override Size MeasureOverride(Size availableSize)
{
Control child = ((IVisual)this).VisualChildren.SingleOrDefault() as Control;

Loading…
Cancel
Save