/// <summary>
        /// Initializes a new instance of the <see cref="CalendarPickerView"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="attrs">The attrs.</param>
        public CalendarPickerView(Context context, IAttributeSet attrs)
            : base(context, attrs)
        {
            ResourceIdManager.UpdateIdValues();
            _context         = context;
            _styleDescriptor = new StyleDescriptor();
            MyAdapter        = new MonthAdapter(context, this);
            base.Adapter     = MyAdapter;


            //SetPadding(0, 0, 0, 0);

            var bgColor = base.Resources.GetColor(Resource.Color.calendar_bg);

            base.SetBackgroundColor(bgColor);

            MonthNameFormat        = base.Resources.GetString(Resource.String.month_name_format);
            WeekdayNameFormat      = base.Resources.GetString(Resource.String.day_name_format);
            FullDateFormat         = CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern;
            ClickHandler          += OnCellClicked;
            OnInvalidDateSelected += OnInvalidateDateClicked;
            SetOnPageChangeListener(new OnPageChangeListener(this));



            if (base.IsInEditMode)
            {
                Init(DateTime.Now, DateTime.Now.AddYears(1), new DayOfWeek[] { }).WithSelectedDate(DateTime.Now);
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CalendarPickerView"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="attrs">The attrs.</param>
        public CalendarPickerView(Context context, IAttributeSet attrs)
            : base(context, attrs)
        {
            ResourceIdManager.UpdateIdValues();
            _context         = context;
            _styleDescriptor = new StyleDescriptor();
            MyAdapter        = new MonthAdapter(context, this);
            base.Adapter     = MyAdapter;

            //base.Divider = null;
            //base.DividerHeight = 0;
            this.PageMargin = 32;
            SetPadding(0, 0, 0, 0);

            //Sometimes dates could not be selected after the transform. I had to disable it. :(
            //SetPageTransformer(true, new CalendarMonthPageTransformer());

            var bgColor = base.Resources.GetColor(Resource.Color.calendar_bg);

            base.SetBackgroundColor(bgColor);
            //base.CacheColorHint = bgColor;

            MonthNameFormat        = base.Resources.GetString(Resource.String.month_name_format);
            WeekdayNameFormat      = base.Resources.GetString(Resource.String.day_name_format);
            FullDateFormat         = CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern;
            ClickHandler          += OnCellClicked;
            OnInvalidDateSelected += OnInvalidateDateClicked;
            this.SetOnPageChangeListener(new OnPageChangeListener(this));



            if (base.IsInEditMode)
            {
                Init(DateTime.Now, DateTime.Now.AddYears(1), new DayOfWeek[] { }).WithSelectedDate(DateTime.Now);
            }
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="CalendarPickerView"/> class.
		/// </summary>
		/// <param name="context">The context.</param>
		/// <param name="attrs">The attrs.</param>
		public CalendarPickerView(Context context, IAttributeSet attrs)
			: base(context, attrs)
		{
			ResourceIdManager.UpdateIdValues();
			_context = context;
			_styleDescriptor = new StyleDescriptor();
			MyAdapter = new MonthAdapter(context, this);
			base.Adapter = MyAdapter;

			//base.Divider = null;
			//base.DividerHeight = 0;
			this.PageMargin = 32;
			SetPadding(0, 0, 0, 0);

			//Sometimes dates could not be selected after the transform. I had to disable it. :(
			//SetPageTransformer(true, new CalendarMonthPageTransformer());

			var bgColor = base.Resources.GetColor(Resource.Color.calendar_bg);
			base.SetBackgroundColor(bgColor);
			//base.CacheColorHint = bgColor;

			MonthNameFormat = base.Resources.GetString(Resource.String.month_name_format);
			WeekdayNameFormat = base.Resources.GetString(Resource.String.day_name_format);
			FullDateFormat = CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern;
			ClickHandler += OnCellClicked;
			OnInvalidDateSelected += OnInvalidateDateClicked;
			this.SetOnPageChangeListener(new OnPageChangeListener(this));



			if(base.IsInEditMode) {
				Init(DateTime.Now, DateTime.Now.AddYears(1), new DayOfWeek[]{ }).WithSelectedDate(DateTime.Now);
			}
		}