public AreaContainer getNearestAncestorAreaContainer() { Area area = this.getParent(); while (area != null && !(area is AreaContainer)) { area = area.getParent(); } return((AreaContainer)area); }
public AreaContainer getNearestAncestorAreaContainer() { // Try to locate the closest parent that can be // casted to AreaContainer Area area = this.getParent(); AreaContainer output = area as AreaContainer; while (area != null && output == null) { area = area.getParent(); output = area as AreaContainer; } return(output); }
private bool startsAC(Area area) { Area parent = null; while ((parent = area.getParent()) != null && parent.hasNonSpaceChildren() == false) { if (parent is AreaContainer && ((AreaContainer)parent).getPosition() == Position.ABSOLUTE) { return true; } area = parent; } return false; }