public override void ViewDidLoad () { this.AddOption ("Year", SelectYear); this.AddOption ("Month", SelectMonth); this.AddOption ("Month Names", SelectMonthNames); this.AddOption ("Year Numbers", SelectYearNumbers); this.AddOption ("Flow", SelectFlow); this.AddOption ("Week view", SelectWeekView); base.ViewDidLoad (); NSCalendar calendar = new NSCalendar (NSCalendarType.Gregorian); calendar.FirstWeekDay = 2; NSDate date = NSDate.Now; NSDateComponents components = new NSDateComponents (); components.Year = -10; NSDate minDate = calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0); components.Year = 10; NSDate maxDate = calendar.DateByAddingComponents (components, date, (NSCalendarOptions)0); this.CalendarView = new TKCalendar (this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview (this.CalendarView); this.calendarDelegate = new CalendarDelegate(this); this.CalendarView.Delegate = calendarDelegate; this.CalendarView.ViewMode = TKCalendarViewMode.Year; this.CalendarView.Calendar = calendar; this.CalendarView.MinDate = minDate; this.CalendarView.MaxDate = maxDate; this.CalendarView.NavigateToDate (date, false); }
public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { calendar.Theme = new TKCalendarIPadTheme(); calendar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; if (calendar.Presenter is TKCalendarMonthPresenter) { TKCalendarMonthPresenter presenter = calendar.Presenter as TKCalendarMonthPresenter; presenter.Style.DayNameTextEffect = TKCalendarTextEffect.None; } if (cell is TKCalendarCell) { TKCalendarDayCell dayCell = cell as TKCalendarDayCell; if (dayCell != null) { TKCalendarDayState selectedState = TKCalendarDayState.Selected; if ((dayCell.State & TKCalendarDayState.Today) != 0) { cell.Style.TextColor = UIColor.FromRGB(24, 149, 132); } if ((dayCell.State & selectedState) == selectedState) { cell.Style.BackgroundColor = UIColor.FromRGB(184, 184, 184); } } } base.UpdateVisualsForCell(calendar, cell); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.CalendarView = new TKCalendar(new RectangleF()); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.CalendarView.Delegate = calendarDelegate; this.View.AddSubview(this.CalendarView); NSDate date = NSDate.Now; NSDateComponents components = new NSDateComponents(); components.Year = -1; this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, NSCalendarOptions.None); components.Year = 1; this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, NSCalendarOptions.None); UIImage img = UIImage.FromBundle("calendar_header.png"); TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter; presenter.Style.TitleCellHeight = 20; presenter.HeaderView.ContentMode = UIViewContentMode.ScaleToFill; presenter.HeaderView.BackgroundColor = UIColor.FromPatternImage(img); }
public override void ViewDidLoad() { this.AddOption ("Russian", SelectRussian); this.AddOption ("German", SelectGerman); this.AddOption ("Hebrew", SelectHebrew); this.AddOption ("Chinese", SelectChinese); this.AddOption ("Islamic", SelectIslamic); this.SelectedOption = 2; base.ViewDidLoad (); this.CalendarView = new TKCalendar (this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; this.View.AddSubview (this.CalendarView); NSDate date = NSDate.Now; NSDateComponents components = new NSDateComponents (); components.Year = -1; this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, NSCalendarOptions.None); components.Year = 1; this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, NSCalendarOptions.None); this.SelectHebrew (this, EventArgs.Empty); }
public override void DidChangedViewModeFrom(TKCalendar calendar, TKCalendarViewMode previousViewMode, TKCalendarViewMode viewMode) { if (viewMode == TKCalendarViewMode.Week || previousViewMode == TKCalendarViewMode.Week) { this.main.View.SetNeedsLayout(); } }
public AlertCustomContentView(CGRect frame) : base(frame) { Double width = frame.Size.Width; Double height = frame.Size.Height; UIColor color = new UIColor(0.5f, 0.7f, 0.2f, 1f); calendarView = new TKCalendar(new CGRect(width / 2 - 0.5f, 0, width / 2 + 0.5f, height)); calendarView.Delegate = new CalendarDelegate(this); this.AddSubview(calendarView); calendarView.TintColor = UIColor.White; TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)calendarView.Presenter; presenter.Style.BackgroundColor = color; dayLabel = new UILabel(new CGRect(0, 0, width / 2, height)); dayLabel.TextAlignment = UITextAlignment.Center; dayLabel.TextColor = color; dayLabel.Font = UIFont.SystemFontOfSize(60); dayLabel.Text = "20"; this.AddSubview(dayLabel); calendarView.SelectedDate = new NSDate(); }
public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { cell.Style.TextColor = new UIColor(1f, 1f, 1f, 1f); cell.Style.BottomBorderWidth = 0; cell.Style.TopBorderWidth = 0; cell.Style.TextFont = UIFont.SystemFontOfSize(10); cell.Style.ShapeFill = new TKSolidFill(new UIColor(1f, 1f, 1f, 1f)); if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarDayCell)))) { TKCalendarDayCell dayCell = (TKCalendarDayCell)cell; if ((dayCell.State & TKCalendarDayState.Selected) != 0) { dayCell.Style.TextColor = new UIColor(0.5f, 0.7f, 0.2f, 1f); } } if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarDayNameCell)))) { TKCalendarDayNameCell dayNameCell = (TKCalendarDayNameCell)cell; dayNameCell.Label.Text = dayNameCell.Label.Text.Substring(0, 1); } if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarMonthTitleCell)))) { TKCalendarMonthTitleCell titleCell = (TKCalendarMonthTitleCell)cell; titleCell.LayoutMode = TKCalendarMonthTitleCellLayoutMode.MonthWithButtons; } }
public override void ViewDidLoad() { this.AddOption("Russian", SelectRussian); this.AddOption("German", SelectGerman); this.AddOption("Hebrew", SelectHebrew); this.AddOption("Chinese", SelectChinese); this.AddOption("Islamic", SelectIslamic); this.SelectedOption = 2; base.ViewDidLoad(); this.CalendarView = new TKCalendar(this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; this.View.AddSubview(this.CalendarView); NSDate date = NSDate.Now; NSDateComponents components = new NSDateComponents(); components.Year = -1; this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, NSCalendarOptions.None); components.Year = 1; this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, NSCalendarOptions.None); this.SelectHebrew(this, EventArgs.Empty); }
public override void ViewDidLoad() { this.CreateEvents(); base.ViewDidLoad(); this.calendarDataSource = new CalendarDataSource(this); this.CalendarView = new TKCalendar(this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.CalendarView.DataSource = this.calendarDataSource; this.View.AddSubview(this.CalendarView); NSDate date = NSDate.Now; NSDateComponents components = new NSDateComponents(); components.Year = -1; this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, NSCalendarOptions.None); components.Year = 1; this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents(components, date, NSCalendarOptions.None); TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { presenter.InlineEventsViewMode = TKCalendarInlineEventsViewMode.Popover; } else { presenter.InlineEventsViewMode = TKCalendarInlineEventsViewMode.Inline; } presenter.InlineEventsView = new MyInlineEventsView(); presenter.InlineEventsView.MaxHeight = 140; presenter.InlineEventsView.FixedHeight = false; }
public override void ViewDidLoad() { base.ViewDidLoad(); NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian); calendar.FirstWeekDay = 2; NSDate date = NSDate.Now; NSDateComponents components = new NSDateComponents(); components.Year = -10; NSDate minDate = calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0); components.Year = 10; NSDate maxDate = calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0); this.CalendarView = new TKCalendar(this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(this.CalendarView); this.CalendarView.Delegate = new CalendarDelegate(this); this.CalendarView.ViewMode = TKCalendarViewMode.Year; this.CalendarView.Calendar = calendar; this.CalendarView.MinDate = minDate; this.CalendarView.MaxDate = maxDate; this.CalendarView.NavigateToDate(date, false); }
public override void UpdateVisualsForCell (TKCalendar calendar, TKCalendarCell cell) { cell.Style.TextColor = new UIColor (1f, 1f, 1f, 1f); cell.Style.BottomBorderWidth = 0; cell.Style.TopBorderWidth = 0; cell.Style.TextFont = UIFont.SystemFontOfSize (10); cell.Style.ShapeFill = new TKSolidFill(new UIColor(1f, 1f, 1f, 1f)); if(cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarDayCell)))) { TKCalendarDayCell dayCell = (TKCalendarDayCell)cell; if ((dayCell.State & TKCalendarDayState.Selected) != 0) { dayCell.Style.TextColor = new UIColor(0.5f, 0.7f, 0.2f, 1f); } } if(cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarDayNameCell)))) { TKCalendarDayNameCell dayNameCell = (TKCalendarDayNameCell)cell; dayNameCell.Label.Text = dayNameCell.Label.Text.Substring (0, 1); } if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarMonthTitleCell)))) { TKCalendarMonthTitleCell titleCell = (TKCalendarMonthTitleCell)cell; titleCell.LayoutMode = TKCalendarMonthTitleCellLayoutMode.MonthWithButtons; } }
public override void ViewDidLoad () { this.CreateEvents (); base.ViewDidLoad (); this.calendarDataSource = new CalendarDataSource (this); this.CalendarView = new TKCalendar (this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.CalendarView.DataSource = this.calendarDataSource; this.View.AddSubview (this.CalendarView); NSDate date = NSDate.Now; NSDateComponents components = new NSDateComponents (); components.Year = -1; this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, NSCalendarOptions.None); components.Year = 1; this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, NSCalendarOptions.None); TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { presenter.InlineEventsViewMode = TKCalendarInlineEventsViewMode.Popover; } else { presenter.InlineEventsViewMode = TKCalendarInlineEventsViewMode.Inline; } presenter.InlineEventsView = new MyInlineEventsView (); presenter.InlineEventsView.MaxHeight = 140; presenter.InlineEventsView.FixedHeight = false; }
public override void ViewDidLoad() { base.ViewDidLoad(); // >> getting-started-calendar-cs TKCalendar calendarView = new TKCalendar(this.View.Bounds); calendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(calendarView); // << getting-started-calendar-cs calendarDelegate = new CalendarDelegate(); // >> getting-started-assigndatasource-cs calendarView.DataSource = new CalendarDataSource(this); // << getting-started-assigndatasource-cs // >> getting-started-event-cs events = new List <TKCalendarEvent> (); NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian); NSDate date = NSDate.Now; Random r = new Random(); for (int i = 0; i < 3; i++) { TKCalendarEvent ev = new TKCalendarEvent(); ev.Title = "Sample event"; NSDateComponents components = calendar.Components(NSCalendarUnit.Day | NSCalendarUnit.Month | NSCalendarUnit.Year, date); components.Day = r.Next() % 20; ev.StartDate = calendar.DateFromComponents(components); ev.EndDate = calendar.DateFromComponents(components); ev.EventColor = UIColor.Red; events.Add(ev); } // << getting-started-event-cs // >> getting-started-minmaxdate-cs calendarView.MinDate = TKCalendar.DateWithYear(2010, 1, 1, calendar); calendarView.MaxDate = TKCalendar.DateWithYear(2016, 12, 31, calendar); // << getting-started-minmaxdate-cs // calendarDelegate.events = this.events; calendarView.Delegate = calendarDelegate; // >> getting-started-navigatetodate-cs NSDateComponents newComponents = new NSDateComponents(); newComponents.Year = 2015; newComponents.Month = 5; newComponents.Day = 1; NSDate newDate = calendarView.Calendar.DateFromComponents(newComponents); // >> navigation-navigate-cs calendarView.NavigateToDate(newDate, true); // << navigation-navigate-cs // << getting-started-navigatetodate-cs calendarView.ReloadData(); }
public override TKCalendarCell ViewForCellOfKind(TKCalendar calendar, TKCalendarCellType cellType) { if (cellType == TKCalendarCellType.Day) { return new CustomCell (); } return null; }
public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarMonthTitleCell)))) { TKCalendarMonthTitleCell monthTitleCell = (TKCalendarMonthTitleCell)cell; monthTitleCell.LayoutMode = TKCalendarMonthTitleCellLayoutMode.MonthAndYearWithButotns; } }
public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { var dayCell = cell as TKCalendarDayCell; if (dayCell != null) { this.SetBordersWidth(dayCell, 0); TKCalendarDayState currentMonthState = TKCalendarDayState.CurrentMonth; if ((dayCell.State & currentMonthState) == currentMonthState) { dayCell.Style.BackgroundColor = Color.FromHex("#F8F8F8").ToUIColor(); dayCell.Style.TextColor = Color.FromHex("#000000").ToUIColor(); } else { dayCell.Style.BackgroundColor = Color.FromHex("#E0E0E0").ToUIColor(); dayCell.Style.TextColor = Color.FromHex("#FFFFFF").ToUIColor(); } TKCalendarDayState weekendState = TKCalendarDayState.Weekend; if ((dayCell.State & weekendState) == weekendState) { if ((dayCell.State & currentMonthState) == currentMonthState) { dayCell.Style.BackgroundColor = Color.FromHex("#EEEEEE").ToUIColor(); dayCell.Style.TextColor = Color.FromHex("#999999").ToUIColor(); } else { dayCell.Style.BackgroundColor = Color.FromHex("#D0D0D0").ToUIColor(); dayCell.Style.TextColor = Color.FromHex("#AAAAAA").ToUIColor(); } } TKCalendarDayState todayState = TKCalendarDayState.Today; if ((dayCell.State & todayState) == todayState) { var borderColor = Color.FromHex("#00FF44"); dayCell.Style.ShapeFill = null; this.SetBordersColor(dayCell, borderColor); this.SetBordersWidth(dayCell, 2); } TKCalendarDayState selectedState = TKCalendarDayState.Selected; if ((dayCell.State & selectedState) == selectedState) { var borderColor = Color.FromHex("#0044FF"); dayCell.Style.ShapeFill = null; this.SetBordersColor(dayCell, borderColor); this.SetBordersWidth(dayCell, 2); } } }
public override void ViewDidLoad() { base.ViewDidLoad(); this.tableViewDataSource = new TableViewDataSource(this); this.TableView = new UITableView(new RectangleF()); this.TableView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; this.TableView.RegisterClassForCellReuse(typeof(UITableViewCell), new NSString("cell")); this.TableView.DataSource = this.tableViewDataSource; this.View.AddSubview(this.TableView); NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian); calendar.FirstWeekDay = 2; NSDateComponents components = new NSDateComponents(); components.Year = -10; NSDate minDate = calendar.DateByAddingComponents(components, NSDate.Now, (NSCalendarOptions)0); components.Year = 10; NSDate maxDate = calendar.DateByAddingComponents(components, NSDate.Now, (NSCalendarOptions)0); this.calendarDelegate = new CalendarDelegate(this); this.calendarDataSource = new CalendarDataSource(this); this.CalendarView = new TKCalendar(new RectangleF()); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.CalendarView.Calendar = calendar; this.CalendarView.Delegate = calendarDelegate; this.CalendarView.DataSource = calendarDataSource; // >> navigation-minmaxdate-cs this.CalendarView.MinDate = minDate; this.CalendarView.MaxDate = maxDate; // << navigation-minmaxdate-cs this.CalendarView.AllowPinchZoom = true; TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter; presenter.Style.TitleCellHeight = 40; presenter.HeaderIsSticky = true; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { presenter.WeekNumbersHidden = true; // >> customizations-ipad-cs this.CalendarView.Theme = new TKCalendarIPadTheme(); // << customizations-ipad-cs presenter.Update(true); } else { presenter.WeekNumbersHidden = false; } this.View.AddSubview(this.CalendarView); }
public override TKCalendarCell ViewForCellOfKind(TKCalendar calendar, TKCalendarCellType cellType) { if (cellType == TKCalendarCellType.Day) { return(new CustomCell()); } return(null); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.CalendarView = new TKCalendar(this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; this.View.AddSubview(this.CalendarView); this.SelectHebrew(this, EventArgs.Empty); }
public override void ViewDidLoad() { base.ViewDidLoad (); this.CalendarView = new TKCalendar (this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; this.View.AddSubview (this.CalendarView); this.SelectHebrew (this, EventArgs.Empty); }
public override void DidChangedViewModeFrom(TKCalendar calendar, TKCalendarViewMode previousViewMode, TKCalendarViewMode viewMode) { if (viewMode == TKCalendarViewMode.Month) { TKCalendarMonthPresenter monthPresenter = (TKCalendarMonthPresenter)calendar.Presenter; monthPresenter.ContentView.BackgroundColor = main.Colors [main.ColorIndex]; monthPresenter.Delegate = new CalendarPresenterDelegate(main); monthPresenter.TransitionMode = main.TransitionMode; } }
public void ButtonTouched() { this.Title = "Back"; NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian); TKCalendarYearViewController controller = new TKCalendarYearViewController(); controller.ContentView.MinDate = TKCalendar.DateWithYear(2012, 1, 1, calendar); controller.ContentView.MaxDate = TKCalendar.DateWithYear(2018, 12, 31, calendar); controller.ContentView.NavigateToDate(NSDate.Now, false); this.NavigationController.PushViewController(controller, true); }
// >> customization-updatevisualcell-cs public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { if (cell is TKCalendarDayCell) { TKCalendarDayCell dayCell = (TKCalendarDayCell)cell; if ((dayCell.State & TKCalendarDayState.Today) != 0) { cell.Style.TextColor = UIColor.Red; } else { cell.Style.TextColor = UIColor.Purple; } } }
public override void ViewDidLoad() { base.ViewDidLoad (); this.CalendarView = new TKCalendar (new RectangleF ()); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.CalendarView.Delegate = new CalendarDelegate (); this.View.AddSubview (this.CalendarView); UIImage img = new UIImage ("calendar_header.png"); TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter; presenter.Style.TitleCellHeight = 20; presenter.HeaderView.ContentMode = UIViewContentMode.ScaleToFill; presenter.HeaderView.BackgroundColor = UIColor.FromPatternImage (img); }
public override void ViewDidLoad () { base.ViewDidLoad (); this.tableViewDataSource = new TableViewDataSource (this); this.TableView = new UITableView (new RectangleF ()); this.TableView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin; this.TableView.RegisterClassForCellReuse (typeof(UITableViewCell), new NSString("cell")); this.TableView.DataSource = this.tableViewDataSource; this.View.AddSubview (this.TableView); NSCalendar calendar = new NSCalendar (NSCalendarType.Gregorian); calendar.FirstWeekDay = 2; NSDateComponents components = new NSDateComponents (); components.Year = -10; NSDate minDate = calendar.DateByAddingComponents (components, NSDate.Now, (NSCalendarOptions)0); components.Year = 10; NSDate maxDate = calendar.DateByAddingComponents (components, NSDate.Now, (NSCalendarOptions)0); this.calendarDelegate = new CalendarDelegate (this); this.calendarDataSource = new CalendarDataSource (this); this.CalendarView = new TKCalendar (new RectangleF()); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.CalendarView.Calendar = calendar; this.CalendarView.Delegate = calendarDelegate; this.CalendarView.DataSource = calendarDataSource; this.CalendarView.MinDate = minDate; this.CalendarView.MaxDate = maxDate; this.CalendarView.AllowPinchZoom = true; TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter; presenter.Style.TitleCellHeight = 40; presenter.HeaderIsSticky = true; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { presenter.WeekNumbersHidden = true; this.CalendarView.Theme = new TKCalendarIPadTheme (); presenter.Update (true); } else { presenter.WeekNumbersHidden = false; } this.View.AddSubview (this.CalendarView); }
public override void ViewDidLoad() { this.AddOption ("Russian", SelectRussian); this.AddOption ("German", SelectGerman); this.AddOption ("Hebrew", SelectHebrew); this.AddOption ("Chinese", SelectChinese); this.AddOption ("Islamic", SelectIslamic); this.SelectedOption = 2; base.ViewDidLoad (); this.CalendarView = new TKCalendar (this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; this.View.AddSubview (this.CalendarView); this.SelectHebrew (this, EventArgs.Empty); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.CalendarView = new TKCalendar(new RectangleF()); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.CalendarView.Delegate = new CalendarDelegate(); this.View.AddSubview(this.CalendarView); UIImage img = new UIImage("calendar_header.png"); TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter; presenter.Style.TitleCellHeight = 20; presenter.HeaderView.ContentMode = UIViewContentMode.ScaleToFill; presenter.HeaderView.BackgroundColor = UIColor.FromPatternImage(img); }
public override void ViewDidLoad() { this.AddOption("Year", SelectYear); this.AddOption("Month", SelectMonth); this.AddOption("Month Names", SelectMonthNames); this.AddOption("Year Numbers", SelectYearNumbers); this.AddOption("Flow", SelectFlow); this.AddOption("Week view", SelectWeekView); base.ViewDidLoad(); NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian); calendar.FirstWeekDay = 2; NSDate date = NSDate.Now; NSDateComponents components = new NSDateComponents(); components.Year = -10; NSDate minDate = calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0); components.Year = 10; NSDate maxDate = calendar.DateByAddingComponents(components, date, (NSCalendarOptions)0); this.CalendarView = new TKCalendar(this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(this.CalendarView); this.calendarDelegate = new CalendarDelegate(this); this.CalendarView.Delegate = calendarDelegate; this.CalendarView.ViewMode = TKCalendarViewMode.Year; this.CalendarView.Calendar = calendar; this.CalendarView.MinDate = minDate; this.CalendarView.MaxDate = maxDate; // >> view-modes-pinchzoom-cs this.CalendarView.AllowPinchZoom = false; // << view-modes-pinchzoom-cs this.CalendarView.NavigateToDate(date, false); // >> view-modes-presenter-cs TKCalendarYearPresenter presenter = (TKCalendarYearPresenter)this.CalendarView.Presenter; presenter.Columns = 3; // << view-modes-presenter-cs }
public void ButtonTouched() { this.Title = "Back"; // >> localization-firstweekday-cs NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian); calendar.FirstWeekDay = 2; // << localization-firstweekday-cs // >> view-modes-viewcontroller-cs TKCalendarYearViewController controller = new TKCalendarYearViewController(); controller.ContentView.MinDate = TKCalendar.DateWithYear(2012, 1, 1, calendar); controller.ContentView.MaxDate = TKCalendar.DateWithYear(2018, 12, 31, calendar); controller.ContentView.NavigateToDate(NSDate.Now, false); this.NavigationController.PushViewController(controller, true); // << view-modes-viewcontroller-cs }
public void setupCalendar() { NSMutableArray items = new NSMutableArray(); // >> datasource-calendar-ui-cs this.dataSource.DisplayKey = "Name"; this.dataSource.Settings.Calendar.StartDateKey = "StartDate"; this.dataSource.Settings.Calendar.EndDateKey = "EndDate"; this.dataSource.Settings.Calendar.DefaultEventColor = UIColor.Red; this.dataSource.ItemSource = items; var calendar = new TKCalendar(this.View.Bounds); calendar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.dataSource.SetDataSourceFor(calendar); this.View.AddSubview(calendar); // << datasource-calendar-ui-cs }
void useCalendar(object sender, EventArgs args) { if (this.View.Subviews.Length > 0) { this.View.Subviews [0].RemoveFromSuperview (); } this.dataSource.Settings.Calendar.StartDateKey = "Date"; this.dataSource.Settings.Calendar.EndDateKey = "Date"; this.dataSource.Settings.Calendar.DefaultEventColor = UIColor.Red; TKCalendar calendar = new TKCalendar (this.View.Bounds); calendar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview (calendar); TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)calendar.Presenter; presenter.InlineEventsViewMode = TKCalendarInlineEventsViewMode.Inline; this.dataSource.SetDataSourceFor (calendar); }
public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { if (cell is TKCalendarDayCell dayCell) { TKCalendarDayState todayState = TKCalendarDayState.Today; if ((dayCell.State & todayState) == todayState) { var borderColor = Color.FromHex("#0044FF").ToUIColor(); dayCell.Style.ShapeFill = null; cell.Style.TopBorderColor = borderColor; cell.Style.LeftBorderColor = borderColor; cell.Style.RightBorderColor = borderColor; cell.Style.BottomBorderColor = borderColor; cell.Style.TopBorderWidth = 2; cell.Style.LeftBorderWidth = 2; cell.Style.RightBorderWidth = 2; cell.Style.BottomBorderWidth = 2; } TKCalendarDayState selectedState = TKCalendarDayState.Selected; if ((dayCell.State & selectedState) == selectedState) { var borderColor = Color.FromHex("#00FF44").ToUIColor(); dayCell.Style.Shape = new TKPredefinedShape(TKShapeType.Square, new CGSize(30, 25)); dayCell.Style.ShapeFill = new TKSolidFill(borderColor); cell.Style.TopBorderColor = borderColor; cell.Style.LeftBorderColor = borderColor; cell.Style.RightBorderColor = borderColor; cell.Style.BottomBorderColor = borderColor; cell.Style.TopBorderWidth = 2; cell.Style.LeftBorderWidth = 2; cell.Style.RightBorderWidth = 2; cell.Style.BottomBorderWidth = 2; } } }
// >> getting-started-eventsfordate-cs public TKCalendarEventProtocol[] EventsForDate(TKCalendar calendar, NSDate date) { NSDateComponents components = calendar.Calendar.Components(NSCalendarUnit.Day | NSCalendarUnit.Month | NSCalendarUnit.Year, date); components.Hour = 23; components.Minute = 59; components.Second = 59; NSDate endDate = calendar.Calendar.DateFromComponents(components); List <TKCalendarEventProtocol> filteredEvents = new List <TKCalendarEventProtocol> (); for (int i = 0; i < this.events.Count; i++) { TKCalendarEventProtocol ev = this.events[i]; if (ev.StartDate.SecondsSinceReferenceDate <= endDate.SecondsSinceReferenceDate && ev.EndDate.SecondsSinceReferenceDate >= date.SecondsSinceReferenceDate) { filteredEvents.Add(ev); } } return(filteredEvents.ToArray()); }
void useCalendar() { if (this.View.Subviews.Length > 0) { this.View.Subviews [0].RemoveFromSuperview(); } this.dataSource.Settings.Calendar.StartDateKey = "Date"; this.dataSource.Settings.Calendar.EndDateKey = "Date"; this.dataSource.Settings.Calendar.DefaultEventColor = UIColor.Red; TKCalendar calendar = new TKCalendar(this.View.Bounds); calendar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(calendar); TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)calendar.Presenter; presenter.InlineEventsViewMode = TKCalendarInlineEventsViewMode.Inline; this.dataSource.SetDataSourceFor(calendar); }
public override void ViewDidLoad() { base.ViewDidLoad (); this.CalendarView = new TKCalendar (new RectangleF ()); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.CalendarView.Delegate = calendarDelegate; this.View.AddSubview (this.CalendarView); NSDate date = NSDate.Now; NSDateComponents components = new NSDateComponents (); components.Year = -1; this.CalendarView.MinDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, NSCalendarOptions.None); components.Year = 1; this.CalendarView.MaxDate = this.CalendarView.Calendar.DateByAddingComponents (components, date, NSCalendarOptions.None); UIImage img = new UIImage ("calendar_header.png"); TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter; presenter.Style.TitleCellHeight = 20; presenter.HeaderView.ContentMode = UIViewContentMode.ScaleToFill; presenter.HeaderView.BackgroundColor = UIColor.FromPatternImage (img); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.CalendarView = new TKCalendar(this.View.Bounds); this.CalendarView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.CalendarView.DataSource = new CalendarDataSource(this); this.View.AddSubview(this.CalendarView); TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)this.CalendarView.Presenter; if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { presenter.InlineEventsViewMode = TKCalendarInlineEventsViewMode.Popover; } else { presenter.InlineEventsViewMode = TKCalendarInlineEventsViewMode.Inline; } presenter.InlineEventsView = new MyInlineEventsView(); presenter.InlineEventsView.MaxHeight = 140; presenter.InlineEventsView.FixedHeight = false; }
public override void ViewDidLoad() { // >> customization-theme-cs TKCalendar calendar = new TKCalendar(this.View.Bounds); calendar.Theme = new TKCalendarIPadTheme(); calendar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; this.View.AddSubview(calendar); // << customization-theme-cs calendarDelegate = new CalendarDelegateCustomization(); calendar.Delegate = calendarDelegate; // >> customization-presenter-cs TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)calendar.Presenter; presenter.Style.TitleCellHeight = 40; presenter.Style.BackgroundColor = UIColor.Yellow; presenter.HeaderIsSticky = true; presenter.Style.MonthNameTextEffect = TKCalendarTextEffect.Lowercase; presenter.Update(false); // << customization-presenter-cs }
public AlertCustomContentView(CGRect frame): base(frame) { Double width = frame.Size.Width; Double height = frame.Size.Height; UIColor color = new UIColor (0.5f, 0.7f, 0.2f, 1f); calendarView = new TKCalendar(new CGRect(width/2 - 0.5f, 0, width/2 + 0.5f, height)); calendarView.Delegate = new CalendarDelegate (this); this.AddSubview (calendarView); calendarView.TintColor = UIColor.White; TKCalendarMonthPresenter presenter = (TKCalendarMonthPresenter)calendarView.Presenter; presenter.Style.BackgroundColor = color; dayLabel = new UILabel(new CGRect(0, 0, width/2, height)); dayLabel.TextAlignment = UITextAlignment.Center; dayLabel.TextColor = color; dayLabel.Font = UIFont.SystemFontOfSize (60); dayLabel.Text = "20"; this.AddSubview(dayLabel); calendarView.SelectedDate = new NSDate (); }
public override void DidDeselectedDate(TKCalendar calendar, NSDate date) { Console.WriteLine(String.Format("{0}", date)); }
public override void DidSelectDate(TKCalendar calendar, NSDate date) { main.EventsForDate = calendar.EventsForDate(date); main.TableView.ReloadData(); }
public override void DidChangedViewModeFrom(TKCalendar calendar, TKCalendarViewMode previousViewMode, TKCalendarViewMode viewMode) { if (viewMode == TKCalendarViewMode.Month) { TKCalendarMonthPresenter monthPresenter = (TKCalendarMonthPresenter)calendar.Presenter; monthPresenter.ContentView.BackgroundColor = main.Colors [main.ColorIndex]; monthPresenter.Delegate = new CalendarPresenterDelegate (main); monthPresenter.TransitionMode = main.TransitionMode; } }
public override TKCalendarEventProtocol[] EventsForDate(TKCalendar calendar, NSDate date) { NSDateComponents components = calendar.Calendar.Components (NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, date); components.Hour = 23; components.Minute = 59; components.Second = 59; NSDate endDate = calendar.Calendar.DateFromComponents (components); List<TKCalendarEventProtocol> filteredEvents = new List<TKCalendarEventProtocol> (); for (int i = 0; i < this.owner.Events.Length; i++) { TKCalendarEvent ev = (TKCalendarEvent)this.owner.Events [i]; if (ev.StartDate.SecondsSinceReferenceDate <= endDate.SecondsSinceReferenceDate && ev.EndDate.SecondsSinceReferenceDate >= date.SecondsSinceReferenceDate) { filteredEvents.Add (ev); } } return filteredEvents.ToArray (); }
public override void DidSelectDate (TKCalendar calendar, NSDate date) { NSDateComponents components = calendar.Calendar.Components (NSCalendarUnit.Day, date); owner.dayLabel.Text = new NSString (components.Day.ToString()); }
public override void DidChangedViewModeFrom(TKCalendar calendar, TKCalendarViewMode previousViewMode, TKCalendarViewMode viewMode) { if (viewMode == TKCalendarViewMode.Week || previousViewMode == TKCalendarViewMode.Week) { this.main.View.SetNeedsLayout (); } }
public override void DidSelectDate(TKCalendar calendar, NSDate date) { Console.WriteLine("{0}", date); }
public override bool ShouldSelectDate(TKCalendar calendar, NSDate date) { Console.WriteLine(String.Format("Trying to select the unselectable {0}", date)); return(!TKCalendar.IsDate(main.UnselectableDate, date, NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, main.CalendarView.Calendar)); }
public override void DidSelectDate(TKCalendar calendar, NSDate date) { Console.WriteLine (String.Format ("{0}", date)); }
public override void DidSelectDate(TKCalendar calendar, NSDate date) { main.EventsForDate = calendar.EventsForDate (date); main.TableView.ReloadData (); }
public override bool ShouldSelectDate(TKCalendar calendar, NSDate date) { Console.WriteLine (String.Format ("Trying to select the unselectable {0}", date)); return !TKCalendar.IsDate (main.UnselectableDate, date, NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, main.CalendarView.Calendar); }
public override void UpdateVisualsForCell(TKCalendar calendar, TKCalendarCell cell) { if (cell.IsKindOfClass(new ObjCRuntime.Class(typeof(TKCalendarMonthTitleCell)))) { TKCalendarMonthTitleCell monthTitleCell = (TKCalendarMonthTitleCell)cell; monthTitleCell.LayoutMode = TKCalendarMonthTitleCellLayoutMode.MonthAndYearWithButotns; } }