public void RebuildGrid(bool right, bool animated)
{
UserInteractionEnabled = false;
var gridToMove = CreateNewGrid(CurrentMonthYear);
var pointsToMove = (right? Frame.Width : -Frame.Width);
/*if (left && gridToMove.weekdayOfFirst==0)
pointsToMove += 44;
if (!left && _monthGridView.weekdayOfFirst==0)
pointsToMove -= 44;*/
gridToMove.Frame = new RectangleF(new PointF(pointsToMove, 0), gridToMove.Frame.Size);
_scrollView.AddSubview(gridToMove);
if (animated){
UIView.BeginAnimations("changeMonth");
UIView.SetAnimationDuration(0.4);
UIView.SetAnimationDelay(0.1);
UIView.SetAnimationCurve(UIViewAnimationCurve.EaseInOut);
}
_monthGridView.Center = new PointF(_monthGridView.Center.X - pointsToMove, _monthGridView.Center.Y);
gridToMove.Center = new PointF(gridToMove.Center.X - pointsToMove, gridToMove.Center.Y);
_monthGridView.Alpha = 0;
/*_scrollView.Frame = new RectangleF(
_scrollView.Frame.Location,
new SizeF(_scrollView.Frame.Width, this.Frame.Height-16));
_scrollView.ContentSize = _scrollView.Frame.Size;*/
SetNeedsDisplay();
if (animated)
UIView.CommitAnimations();
_monthGridView = gridToMove;
UserInteractionEnabled = true;
if (MonthChanged != null)
MonthChanged(CurrentMonthYear);
}