private double DetermineWidth() {
if (!double.IsNaN(PositionX)) return _child.DesiredSize.Width;
switch (_child.HorizontalAlignment) {
case HorizontalAlignment.Left:
return _child.DesiredSize.Width;
case HorizontalAlignment.Right:
return _child.DesiredSize.Width;
case HorizontalAlignment.Center:
return _child.DesiredSize.Width;
case HorizontalAlignment.Stretch:
return AdornedElement.ActualWidth;
default:
return 0d;
}
}