public void LayoutChildren(bool animate) { float focusWidth = 0; float focusHeight = 0; if (daysExpanded != 0 && weeksExpanded != 0) { focusWidth = (Width * FOCUS_SIZE_PERCENT) / daysExpanded; focusHeight = (Height * FOCUS_SIZE_PERCENT) / weeksExpanded; } float collapsedWidth = (Width - (focusWidth * daysExpanded)) / (numDays - daysExpanded); float collapsedHeight = (Height - (focusHeight * weeksExpanded)) / (numWeeks - weeksExpanded); float xOffset = 0; float yOffset = 0; float rowHeight = 0; DayNode each = null; for (int week = 0; week < numWeeks; week++) { for (int day = 0; day < numDays; day++) { each = GetDay(week, day); float width = collapsedWidth; float height = collapsedHeight; if (each.HasWidthFocus) { width = focusWidth; } if (each.HasHeightFocus) { height = focusHeight; } if (animate) { each.AnimateToBounds(xOffset, yOffset, width, height, DEFAULT_ANIMATION_MILLIS).StepInterval = 0; } else { each.SetBounds(xOffset, yOffset, width, height); } xOffset += width; rowHeight = height; } xOffset = 0; yOffset += rowHeight; } }