private async void ReadContents(CustomCalendar calendarView) { mDateItems = await SQLiteManager.Instance.LoadActivityDateListAsync(mActivityId); if (mDateItems == null || mDateItems.Count == 0) { ToastManager.ShowLongTime(Activity, Resource.String.toast_no_activity); return; } calendarView.ShowFromDate = mDateItems.OrderByDescending(item => item.Date).First().Date; calendarView.CustomDataAdapter = mDateItems.Select(i => new CustomCalendarData(i.Date)).ToList(); calendarView.OnCalendarSelectedDate += (sender, e) => { var selectedItems = mDateItems.Where(item => { return(e.SelectedDate.Year == item.Date.Year && e.SelectedDate.Month == item.Date.Month && e.SelectedDate.Day == item.Date.Day); }).ToList(); if (selectedItems != null && selectedItems.Count > 0) { ShowToast(selectedItems); } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); CalendarControl = FindViewById <CustomCalendar>(Resource.Id.CalendarControl); CalendarControl.NextButtonText = "Next"; CalendarControl.PreviousButtonText = "Prev"; //CalendarControl.NextButtonVisibility= ViewStates.Invisible; //CalendarControl.PreviousButtonStyleId = Resource.Drawable.default_dim_selector; //CalendarControl.ShowOnlyCurrentMonth = true; CalendarControl.ShowFromDate = new DateTime(); List <CustomCalendarData> customData = new List <CustomCalendarData>(); customData = new List <CustomCalendarData> { new CustomCalendarData(DateTime.Now.AddDays(2)), new CustomCalendarData(DateTime.Now.AddDays(4)), new CustomCalendarData(DateTime.Now.AddDays(-4)) }; CalendarControl.CustomDataAdapter = customData; CalendarControl.OnCalendarMonthChange += CalendarControl_CalendarMonthChange; CalendarControl.OnCalendarSelectedDate += CalendarControl_CalendarDateSelected; }
protected void LoadCalendars() { BroadcastCalendar = new BroadcastCalendar(); CustomCalendar = new CustomCalendar(); if (!_scheduleFile.Exists) { return; } var document = new XmlDocument(); document.Load(_scheduleFile.FullName); var node = document.SelectSingleNode(@"/Schedule/BroadcastCalendar"); if (node != null) { BroadcastCalendar.Deserialize(node); } node = document.SelectSingleNode(@"/Schedule/CustomCalendar"); if (node != null) { CustomCalendar.Deserialize(node); } }
private void InitializeObjects() { calendar = FindViewById <CustomCalendar>(Resource.Id.calendar); calendar.NextButtonText = Resources.GetString(Resource.String.next); calendar.PreviousButtonText = Resources.GetString(Resource.String.previous); calendar.OnCalendarSelectedDate += CalendarOnOnCalendarSelectedDate; toolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar); }
private void OnDropDownButtonClick(object sender, EventArgs e) { var highlightedDates = new List<HighlightedDates>(); highlightedDates.Add(new HighlightedDates(Convert.ToDateTime(_maskedTextBox.Text.Trim()), Color.Red, Color.Blue, Color.Pink, true)); _customCalendar = new CustomCalendar(highlightedDates); _customCalendar.CustomCalendarEvent += OnCustomCalendarEvent; _customCalendar.Location = new Point(0, 20); Controls.Add(_customCalendar); }
private void OnDropDownButtonClick(object sender, EventArgs e) { var highlightedDates = new List <HighlightedDates>(); highlightedDates.Add(new HighlightedDates(Convert.ToDateTime(_maskedTextBox.Text.Trim()), Color.Red, Color.Blue, Color.Pink, true)); _customCalendar = new CustomCalendar(highlightedDates); _customCalendar.CustomCalendarEvent += OnCustomCalendarEvent; _customCalendar.Location = new Point(0, 20); Controls.Add(_customCalendar); }
public ThirdPartyControlWithStyleForm() { InitializeComponent(); var myHostControl = new Microsoft.Toolkit.Forms.UI.XamlHost.WindowsXamlHost(); myHostControl.Dock = DockStyle.Fill; myHostControl.Name = "uwpHost"; var customControl = new CustomCalendar(); customControl.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch; customControl.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch; myHostControl.Child = customControl; pnlXamlIsland.Controls.Add(myHostControl); var data = new DataModel(); customControl.DataContext = data; dtpPickDate.DataBindings.Add(new Binding(nameof(DateTimePicker.Value), data, nameof(DataModel.MyDate), true, DataSourceUpdateMode.OnPropertyChanged)); lblDate.DataBindings.Add(new Binding(nameof(Label.Text), data, nameof(DataModel.DateAsString), true, DataSourceUpdateMode.OnPropertyChanged)); }
private void OnCustomCalendarEvent(object sender, CustomCalendarEventArgs eventArgs) { _maskedTextBox.Text = eventArgs.SelectedDate; Controls.Remove(_customCalendar); _customCalendar = null; }
public CalendarCustomRenderer() { Content = new CustomCalendar(); }