/// <summary> /// Destroys the item. /// </summary> /// <param name="container">The container.</param> /// <param name="position">The position.</param> /// <param name="object">The object.</param> public override void DestroyItem(Android.Views.View container, int position, Java.Lang.Object @object) { //activePickerViews[position].OnDateSelected -= HandleOnDateSelected; //activePickerViews.Remove(position); var monthView = @object.JavaCast <MonthView>(); (container.JavaCast <Android.Support.V4.View.ViewPager>()).RemoveView(monthView); _reusableMonthView = monthView; _activeMonthViews.Remove(position); }
/// <summary> /// Instantiates the item. /// </summary> /// <param name="container">The container.</param> /// <param name="position">The position.</param> /// <returns>Java.Lang.Object.</returns> public override Java.Lang.Object InstantiateItem(Android.Views.View container, int position) { Java.Lang.Object obj = container; var pager = obj.JavaCast <Android.Support.V4.View.ViewPager>(); MonthView monthView = null; if (_reusableMonthView == null) { monthView = MonthView.Create(pager, _inflater, _calendar.WeekdayNameFormat, _calendar.Today, _calendar.ClickHandler); } else { monthView = _reusableMonthView; _reusableMonthView = null; } monthView.Init(_calendar.Months[position], _calendar.Cells[position]); //monthView.SetBackgroundColor(global::Android.Graphics.Color.Orange); pager.AddView(monthView); _activeMonthViews[position] = monthView; return(monthView); }