protected override void OnAttachedTo(ContentPage bindable)
 {
     base.OnAttachedTo(bindable);
     viewModel              = bindable.BindingContext as ViewModel;
     calendar               = bindable.FindByName <SfCalendar>("calendar");
     calendar.MonthChanged += OnMonthChanged;
 }
        private void sfCalendarDrawCell(SfCalendar sender, Syncfusion.WinForms.Input.Events.DrawCellEventArgs args)
        {
            args.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

            if (args.IsTrailingDate)
            {
                args.ForeColor = Color.DarkGray;
            }


            //ensure a date is selected
            if (!args.Value.HasValue)
            {
                return;
            }

            DateTime here = args.Value.Value;

            var drawList = getDrawListForDay(here);

            int startPosition = 0;

            foreach (var task in drawList)
            {
                args.Handled = true;

                Color c = args.IsTrailingDate ? Color.DarkGray : Color.Black;

                TextRenderer.DrawText(args.Graphics, args.Value.Value.Day.ToString(), new Font("Segoe UI", 10, System.Drawing.FontStyle.Regular), args.CellBounds, c, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter);

                args.Graphics.FillRectangle(new SolidBrush(task.DrawColor), new System.Drawing.Rectangle((args.CellBounds.X + (args.CellBounds.Width - args.CellBounds.Width / 2)) - (drawList.Count * 2) - (drawList.Count * 6) - startPosition, (args.CellBounds.Y + (args.CellBounds.Height - 20)), 13, 13));
                startPosition -= 18;
            }
        }
示例#3
0
        public override View GetSampleContent(Context context)
        {
            InitialSettings(context);

            //mainLayout
            mainLayout = new FrameLayout(context);
            mainLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.8), GravityFlags.Top | GravityFlags.CenterHorizontal);
            calendar                  = new SfCalendar(context);
            calendar.ViewMode         = ViewMode.MonthView;
            calendar.HeaderHeight     = 100;
            calendar.ShowEventsInline = false;
            calendar.Locale           = new Java.Util.Locale("zh", "CN");
            MonthViewLabelSetting labelSettings = new MonthViewLabelSetting();

            labelSettings.DateLabelSize = 14;
            MonthViewSettings monthViewSettings = new MonthViewSettings();

            monthViewSettings.MonthViewLabelSetting  = labelSettings;
            monthViewSettings.TodayTextColor         = Color.ParseColor("#1B79D6");
            monthViewSettings.InlineBackgroundColor  = Color.ParseColor("#E4E8ED");
            monthViewSettings.WeekDayBackgroundColor = Color.ParseColor("#F7F7F7");
            calendar.MonthViewSettings = monthViewSettings;
            mainLayout.AddView(calendar);

            FrameLayout(context);

            return(frame);
        }
示例#4
0
        public override View GetSampleContent(Context context1)
        {
            context = context1;
            InitialMethod(context);

            //calendar
            calendar = new SfCalendar(context);
            calendar.ShowEventsInline = false;
            calendar.ViewMode         = ViewMode.MonthView;
            calendar.HeaderHeight     = 100;
            MonthViewLabelSetting labelSettings = new MonthViewLabelSetting();

            labelSettings.DateLabelSize = 14;
            MonthViewSettings monthViewSettings = new MonthViewSettings();

            monthViewSettings.MonthViewLabelSetting        = labelSettings;
            monthViewSettings.TodayTextColor               = Color.ParseColor("#1B79D6");
            monthViewSettings.InlineBackgroundColor        = Color.ParseColor("#E4E8ED");
            monthViewSettings.CurrentMonthTextColor        = (Color.ParseColor("#F7F7F7"));
            monthViewSettings.WeekDayBackgroundColor       = Color.ParseColor("#464646");
            monthViewSettings.WeekDayTextColor             = Color.ParseColor("#F9F9F9");
            monthViewSettings.PreviousMonthTextColor       = Color.ParseColor("#BFBFBF");
            monthViewSettings.PreviousMonthBackgroundColor = Color.ParseColor("#F9F9F9");
            calendar.MonthViewSettings = monthViewSettings;
            calendar.DrawMonthCell    += calendar_DrawMonthCell;
            mainLayout.AddView(calendar);

            OptionMainView(context);

            return(frame);
        }
示例#5
0
        public View GetSampleContent(Context con)
        {
            context = con;

            /************
            **Calendar**
            ************/
            MonthViewLabelSetting labelSettings = new MonthViewLabelSetting();

            labelSettings.DateLabelSize = 14;
            MonthViewSettings monthViewSettings = new MonthViewSettings();

            monthViewSettings.MonthViewLabelSetting        = labelSettings;
            monthViewSettings.TodayTextColor               = Color.ParseColor("#1B79D6");
            monthViewSettings.InlineBackgroundColor        = Color.ParseColor("#E4E8ED");
            monthViewSettings.CurrentMonthTextColor        = Color.ParseColor("#F7F7F7");
            monthViewSettings.SelectedDayTextColor         = Color.Black;
            monthViewSettings.WeekDayBackgroundColor       = Color.ParseColor("#464646");
            monthViewSettings.WeekDayTextColor             = Color.ParseColor("#F9F9F9");
            monthViewSettings.PreviousMonthTextColor       = Color.ParseColor("#BFBFBF");
            monthViewSettings.PreviousMonthBackgroundColor = Color.ParseColor("#F9F9F9");

            //Calendar Inizializatation
            calendar = new SfCalendar(con);
            calendar.ShowEventsInline  = false;
            calendar.HeaderHeight      = 100;
            calendar.ViewMode          = ViewMode.MonthView;
            calendar.MonthViewSettings = monthViewSettings;
            calendar.DrawMonthCell    += Calendar_DrawMonthCell;

            //main View
            mainView = new FrameLayout(con);
            mainView.AddView(calendar);
            return(mainView);
        }
示例#6
0
        public override View GetSampleContent(Context context1)
        {
            context = context1;
            InizialMethod();

            //calendar
            calendar = new SfCalendar(context);
            calendar.ShowEventsInline = false;
            calendar.HeaderHeight     = 100;
            MonthViewLabelSetting labelSettings = new MonthViewLabelSetting();

            labelSettings.DateLabelSize = 14;
            MonthViewSettings monthViewSettings = new MonthViewSettings();

            monthViewSettings.MonthViewLabelSetting  = labelSettings;
            monthViewSettings.TodayTextColor         = Color.ParseColor("#1B79D6");
            monthViewSettings.InlineBackgroundColor  = Color.ParseColor("#E4E8ED");
            monthViewSettings.WeekDayBackgroundColor = Color.ParseColor("#F7F7F7");
            calendar.MonthViewSettings = monthViewSettings;
            mainLayout.AddView(calendar);

            OptionMainView();

            return(frame);
        }
示例#7
0
        public void Dispose()
        {
            if (calendar != null)
            {
                calendar.Dispose();
                calendar = null;
            }

            if (mainLayout != null)
            {
                mainLayout.Dispose();
                mainLayout = null;
            }

            if (proprtyOptionsLayout != null)
            {
                proprtyOptionsLayout.Dispose();
                proprtyOptionsLayout = null;
            }

            if (dataAdapter != null)
            {
                dataAdapter.Dispose();
                dataAdapter = null;
            }

            if (cultureSpinner != null)
            {
                cultureSpinner.Dispose();
                cultureSpinner = null;
            }
        }
示例#8
0
        public Calendario()
        {
            InitializeComponent();
            SfCalendar calendario = new SfCalendar();

            this.Content = calendario;
        }
示例#9
0
        public override View GetSampleContent(Context context)
        {
            //mainLayout
            mainLayout                = new FrameLayout(context);
            calendar                  = new SfCalendar(context);
            calendar.ViewMode         = ViewMode.MonthView;
            calendar.HeaderHeight     = 100;
            calendar.ShowEventsInline = false;
            calendar.Locale           = new Java.Util.Locale("zh", "CN");
            MonthViewLabelSetting labelSettings = new MonthViewLabelSetting();

            labelSettings.DateLabelSize = 14;
            MonthViewSettings monthViewSettings = new MonthViewSettings();

            monthViewSettings.MonthViewLabelSetting  = labelSettings;
            monthViewSettings.SelectedDayTextColor   = Color.Black;
            monthViewSettings.TodayTextColor         = Color.ParseColor("#1B79D6");
            monthViewSettings.InlineBackgroundColor  = Color.ParseColor("#E4E8ED");
            monthViewSettings.WeekDayBackgroundColor = Color.ParseColor("#F7F7F7");
            calendar.MonthViewSettings = monthViewSettings;

            mainLayout.AddView(calendar);

            return(mainLayout);
        }
示例#10
0
        public Pag_Calendario()
        {
            InitializeComponent();
            SfCalendar calendar = new SfCalendar();

            calendar.ShowInlineEvents = true;

            CalendarInlineEvent events  = new CalendarInlineEvent();
            CalendarInlineEvent reunion = new CalendarInlineEvent();

            reunion.StartTime = new DateTime(2018, 10, 1, 17, 30, 00);
            reunion.EndTime   = new DateTime(2018, 10, 1, 19, 0, 0);
            reunion.Subject   = "Junta Liber Salus";
            reunion.Color     = Color.Aqua;

            events.StartTime = new DateTime(2018, 10, 11, 12, 0, 0);
            events.EndTime   = new DateTime(2018, 10, 11, 14, 0, 0);
            events.Subject   = "Junta Diana";
            events.Color     = Color.Magenta;

            CalendarEventCollection collection = new CalendarEventCollection();


            collection.Add(events);
            collection.Add(reunion);

            calendar.DataSource = collection;
            //calendar.DataSource = collection;

            this.Content = calendar;
        }
示例#11
0
        public override View GetSampleContent(Context context)
        {
            /************
            **Calendar**
            ************/
            calendar                  = new SfCalendar(context);
            calendar.ViewMode         = ViewMode.MonthView;
            calendar.ShowEventsInline = true;
            getAppointments();
            calendar.DataSource   = appointmentCollection;
            calendar.HeaderHeight = 100;
            //Month View Settings
            MonthViewLabelSetting labelSettings = new MonthViewLabelSetting();

            labelSettings.DateLabelSize = 14;
            MonthViewSettings monthViewSettings = new MonthViewSettings();

            monthViewSettings.MonthViewLabelSetting  = labelSettings;
            monthViewSettings.TodayTextColor         = Color.ParseColor("#1B79D6");
            monthViewSettings.InlineBackgroundColor  = Color.ParseColor("#E4E8ED");
            monthViewSettings.WeekDayBackgroundColor = Color.ParseColor("#F7F7F7");
            calendar.MonthViewSettings = monthViewSettings;

            //Main View
            mainView = new FrameLayout(context);
            mainView.AddView(calendar);
            calendar.UpdateCalendar();

            return(mainView);
        }
示例#12
0
        /// <summary>
        /// Initializes a new instance for the <see cref="DetailPageViewModel" /> class.
        /// </summary>
        public DetailPageViewModel(Models.Product product, INavigation Navigation, List <DateTime> blackoutDates, SfCalendar calendar)
        {
            this.ProductDetail = product;
            this.Navigation    = Navigation;
            this.blackoutDates = blackoutDates;
            this.calendar      = calendar;
            if (this.ProductDetail.Reviews == null || this.ProductDetail.Reviews.Count == 0)
            {
                this.IsReviewVisible = true;
            }
            else
            {
                foreach (var review in this.ProductDetail.Reviews)
                {
                    this.productRating += review.Rating;
                }
            }

            if (this.productRating > 0)
            {
                this.ProductDetail.OverallRating = product.OverallRating;
            }

            this.AddFavouriteCommand = new Command(this.AddFavouriteClicked);
            this.BuyNowCommand       = new Command(this.BuyNowClicked);
            this.BackButtonCommand   = new Command(async() => await BackButtonClicked());

            this.CalendarSelectionChangedCommand = new Command(() => CalendarSelectionChanged());
            //this.CalendarSelectionChangedCommand = new Command(async () => await CalendarSelectionChanged());

            PostaviKalendar();
        }
示例#13
0
        public override View GetSampleContent(Context context)
        {
            /************
            **Calendar**
            ************/
            calendar = new SfCalendar(context);
            calendar.ShowEventsInline = false;
            calendar.ViewMode         = ViewMode.MonthView;
            calendar.BlackoutDates    = GetBlackOutDates();
            calendar.HeaderHeight     = 100;

            //MonthViewSettings
            MonthViewLabelSetting labelSettings = new MonthViewLabelSetting();

            labelSettings.DateLabelSize = 14;
            MonthViewSettings monthViewSettings = new MonthViewSettings();

            monthViewSettings.MonthViewLabelSetting  = labelSettings;
            monthViewSettings.SelectedDayTextColor   = Color.Black;
            monthViewSettings.TodayTextColor         = Color.ParseColor("#1B79D6");
            monthViewSettings.InlineBackgroundColor  = Color.ParseColor("#E4E8ED");
            monthViewSettings.WeekDayBackgroundColor = Color.ParseColor("#F7F7F7");
            calendar.MonthViewSettings = monthViewSettings;

            //Main View
            mainView = new FrameLayout(context);
            mainView.AddView(calendar);
            return(mainView);
        }
示例#14
0
        public Calendar()
        {
            InitializeComponent();

            SfCalendar calendar = new SfCalendar();
            //calendar.SelectionMode = Syncfusion.SfCalendar.XForms.SelectionMode.MultiRangeSelection;
        }
 protected override void OnAttachedTo(ContentPage bindable)
 {
     base.OnAttachedTo(bindable);
     calendar = bindable.FindByName <SfCalendar>("calendar");
     calendar.SelectedDate       = null;
     calendar.OnMonthCellLoaded += Calendar_OnMonthCellLoaded;
     calendar.SelectionChanged  += Calendar_SelectionChanged;
 }
 /// <summary>
 /// Redraw the nodes due panel
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void sfCalendarOverview_SelectionChanged(SfCalendar sender, Syncfusion.WinForms.Input.Events.SelectionChangedEventArgs e)
 {
     //show nodes due on this date
     if (sender.SelectedDate.HasValue)
     {
         drawNodesDue(sender.SelectedDate.Value);
         //sfNodeCalendar.GoToDate(sender.SelectedDate.Value);
     }
 }
        public CalendarViewModel GetDayModelFor(DateTime date, SfCalendar calendar)
        {
            var selectedDate = DateTime.Now;
            var today        = date;

            //calendar.SelectedDate = date;
            if (calendar.SelectedDate != null)
            {
                //calendar.SelectedDate = selectedDate;
                selectedDate = (DateTime)calendar.SelectedDate;
            }

            var selected = false;

            if (calendar.SelectedDate != null && date.Month == selectedDate.Month &&
                date.Year == selectedDate.Year && date.Day == selectedDate.Day)
            {
                selected = true;
                dates.Add(selectedDate);
            }
            else if (this.enableSelection)
            {
                foreach (var item in this.dates)
                {
                    if (item.Month == date.Month &&
                        item.Year == date.Year && item.Day == date.Day)
                    {
                        selected = true;
                        break;
                    }
                }
            }
            calendar.SelectedDates = dates;
            var calendarView = new CalendarViewModel()
            {
                Calendar = calendar,
                Date     = date.Date,
                IsToday  = date.Day == today.Day &&
                           date.Month == today.Month &&
                           date.Year == today.Year,
                IsSelected = selected,
            };

            if (selected)
            {
                calendarView.SelectedTextColor = Color.SpringGreen;
                calendarView.SelectionColor    = Color.Tomato;
            }
            else
            {
                calendarView.SelectedTextColor = Color.Black;
                calendarView.SelectionColor    = Color.Transparent;
            }

            return(calendarView);
        }
        public void Dispose()
        {
            if (calendar != null)
            {
                calendar.Dispose();
                calendar = null;
            }

            if (mainView != null)
            {
                mainView.Dispose();
                mainView = null;
            }

            if (culturetxt != null)
            {
                culturetxt.Dispose();
                culturetxt = null;
            }

            if (cultureSpinner != null)
            {
                cultureSpinner.Dispose();
                cultureSpinner = null;
            }

            if (layoutParams1 != null)
            {
                layoutParams1.Dispose();
                layoutParams1 = null;
            }

            if (separate != null)
            {
                separate.Dispose();
                separate = null;
            }

            if (propertylayout != null)
            {
                propertylayout.Dispose();
                propertylayout = null;
            }

            if (dataAdapter != null)
            {
                dataAdapter.Dispose();
                dataAdapter = null;
            }

            if (localinfo != null)
            {
                localinfo.Dispose();
                localinfo = null;
            }
        }
示例#19
0
        protected override void OnAttachedTo(ContentPage bindable)
        {
            var page = bindable as Page;

            calendar = page.FindByName <SfCalendar>("Calendar");
            calendar.OnInlineLoaded += Calendar_OnInlineLoaded;
            // Setting Datasource for 3 Months.
            calendar.DataSource = calendarInlineEvents;
            base.OnAttachedTo(bindable);
        }
        protected override void OnDetachingFrom(WeekView bindable)
        {
            base.OnDetachingFrom(bindable);
            if (Device.RuntimePlatform == "UWP")
            {
                bindable.SizeChanged -= this.Bindable_SizeChanged;
            }

            this.grid     = null;
            this.calendar = null;
        }
        protected override void OnAttachedTo(ContentPage bindable)
        {
            var page = bindable as Page;

            calendar = page.FindByName <SfCalendar>("Calendar");
            listView = page.FindByName <ListView>("ListView");
            calendar.SelectionChanged += Calendar_SelectionChanged;
            listView.ItemsSource       = GetSelectedDateAppointments(DateTime.Now.Date);
            // Setting Datasource for 3 Months.
            calendar.DataSource = calendarInlineEvents;
            base.OnAttachedTo(bindable);
        }
示例#22
0
        public CalendarViewModel GetDayModelFor(DateTime date, SfCalendar calendar)
        {
            var selectedDate = (DateTime)calendar.SelectedDate;
            var selected     = calendar.SelectedDate != null && date.Month == selectedDate.Month &&
                               date.Year == selectedDate.Year && date.Day == selectedDate.Day;

            return(new CalendarViewModel()
            {
                Date = date.Date,
                IsSelected = selected,
                TextColor = selected ? Color.Yellow : Color.Black,
            });
        }
示例#23
0
 public void Dispose()
 {
     if (calendar != null)
     {
         calendar.Dispose();
         calendar = null;
     }
     if (mainView != null)
     {
         mainView.Dispose();
         mainView = null;
     }
 }
示例#24
0
 public CalendarDayModel GetDayModelFor(DateTime date, SfCalendar calendar)
 {
     return(new CalendarDayModel()
     {
         Calendar = calendar,
         Date = date.Date,
         HasEvents = random.NextDouble() >= 0.5,
         IsToday = date.Day == DateTime.Today.Day &&
                   date.Month == DateTime.Today.Month &&
                   date.Year == DateTime.Today.Year,
         IsCurrentMonth = date.Month == calendar.DisplayDate.Month &&
                          date.Year == calendar.DisplayDate.Year
     });
 }
        public void Dispose()
        {
            if (calendar != null)
            {
                calendar.Dispose();
                calendar = null;
            }
            if (dataAdapter != null)
            {
                dataAdapter.Dispose();
                dataAdapter = null;
            }

            if (modeSpinner != null)
            {
                modeSpinner.Dispose();
                modeSpinner = null;
            }

            if (mainView != null)
            {
                mainView.Dispose();
                mainView = null;
            }

            if (separatorLayoutParams != null)
            {
                separatorLayoutParams.Dispose();
                separatorLayoutParams = null;
            }

            if (separate != null)
            {
                separate.Dispose();
                separate = null;
            }

            if (propertylayout != null)
            {
                propertylayout.Dispose();
                propertylayout = null;
            }

            if (viewModetxt != null)
            {
                viewModetxt.Dispose();
                viewModetxt = null;
            }
        }
示例#26
0
        /// <summary>
        /// Initializes a new instance for the <see cref="DetailPageViewModel" /> class.
        /// </summary>
        public DetailPageViewModel(Models.Product product, INavigation Navigation, List <DateTime> blackoutDates, SfCalendar calendar)
        {
            this.ProductDetail = product;
            this.Navigation    = Navigation;
            this.blackoutDates = blackoutDates;
            this.calendar      = calendar;
            if (this.ProductDetail.Reviews == null || this.ProductDetail.Reviews.Count == 0)
            {
                this.IsReviewVisible = true;
            }
            else
            {
                foreach (var review in this.ProductDetail.Reviews)
                {
                    this.productRating += review.Rating;
                }
            }

            if (this.productRating > 0)
            {
                this.ProductDetail.OverallRating = product.OverallRating;
            }

            for (int i = 0; i < ProductDetail.SizeVariants.Count; i++)
            {
                if (ProductDetail.SizeVariants[i] == ProductDetail.Bicikl.VelicinaOkvira.Naziv)
                {
                    SelectedSizeIndex = i;
                    break;
                }
            }

            this.AddFavouriteCommand = new Command(this.AddFavouriteClicked);
            this.BuyNowCommand       = new Command(this.BuyNowClicked);
            this.AddToCartCommand    = new Command(this.AddToCartClicked);
            this.ShareCommand        = new Command(this.ShareClicked);
            this.VariantCommand      = new Command(async() => await this.VariantClicked());
            this.ItemSelectedCommand = new Command(this.ItemSelected);
            this.CartItemCommand     = new Command(this.CartClicked);
            this.LoadMoreCommand     = new Command(this.LoadMoreClicked);
            this.BackButtonCommand   = new Command(async() => await BackButtonClicked());

            this.CalendarSelectionChangedCommand = new Command(() => CalendarSelectionChanged());
            //this.CalendarSelectionChangedCommand = new Command(async () => await CalendarSelectionChanged());

            PostaviKalendar();
        }
        protected override void OnAttachedTo(ContentPage bindable)
        {
            var page = bindable as Page;

            calendar           = page.FindByName <SfCalendar>("calendar");
            comboBox           = page.FindByName <SfComboBox>("comboBox");
            comboBox.Watermark = "Search Events";

            // To Display Inline appointment layout.
            calendar.ShowInlineEvents = true;
            //Inline ViewMode
            calendar.InlineViewMode = InlineViewMode.Agenda;
            var currentDay = DateTime.Now.Date;

            for (int i = 0; i < 40; i++)
            {
                calendarInlineEvents.Add(new CalendarInlineEvent()
                {
                    StartTime = currentDay.AddDays(i),
                    EndTime   = currentDay.AddDays(i),
                    Subject   = "Meeting on " + currentDay.AddDays(i).ToString("dd/MM/yy"),
                    Color     = Color.Fuchsia
                });

                calendarInlineEvents.Add(new CalendarInlineEvent()
                {
                    StartTime = currentDay.AddDays(i),
                    EndTime   = currentDay.AddDays(i),
                    Subject   = "Conference on " + currentDay.AddDays(i).ToString("dd/MM/yy"),
                    Color     = Color.DodgerBlue
                });
            }

            // Setting Datasource for calendar.
            calendar.DataSource = calendarInlineEvents;

            // Setting Data Source for combo box
            comboBox.DataSource = calendarInlineEvents;
            // Displaying Data in combo box based on subject
            comboBox.DisplayMemberPath = "Subject";
            comboBox.SelectionChanged += ComboBox_SelectionChanged;
            base.OnAttachedTo(bindable);
        }
示例#28
0
 /// <summary>
 /// Event raise to handle the ToolTip for cell in calender
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SfCalendar_ToolTipOpening(SfCalendar sender, ToolTipOpeningEventArgs e)
 {
     if (e.ViewType == Syncfusion.WinForms.Input.Enums.CalendarViewType.Month && !e.IsSpecialDate)
     {
         e.Handled = true;
     }
     if (e.ViewType == Syncfusion.WinForms.Input.Enums.CalendarViewType.Year)
     {
         e.Handled = true;
     }
     if (e.ViewType == Syncfusion.WinForms.Input.Enums.CalendarViewType.Decade)
     {
         e.Handled = true;
     }
     if (e.ViewType == Syncfusion.WinForms.Input.Enums.CalendarViewType.Century)
     {
         e.Handled = true;
     }
 }
示例#29
0
        public MainPage()
        {
            InitializeComponent();
            SfCalendar calendar = new SfCalendar();

            calendar.MoveToDate = new DateTime(2018, 12, 31);
            calendar.MinDate    = new DateTime(2018, 10, 25);
            calendar.MaxDate    = new DateTime(2018, 12, 31);
            List <DateTime> black_dates = new List <DateTime>();

            for (int i = 0; i < 5; i++)
            {
                DateTime date = new DateTime(2018, 12, 1 + i);
                black_dates.Add(date);
            }

            calendar.BlackoutDates = black_dates;
            this.Content           = calendar;
        }
示例#30
0
        /// <summary>
        /// Event for Customize the date celll
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void MonthCalendar_DrawCell(SfCalendar sender, DrawCellEventArgs args)
        {
            DateTime Christmas = new DateTime(2017, 12, 25);
            DateTime Chris     = new DateTime(2017, 12, 12);
            DateTime birthday  = new DateTime(2018, 01, 26);
            DateTime farwell   = new DateTime(2018, 01, 14);
            DateTime newyear   = new DateTime(2018, 01, 01);

            if (args.Value != null)
            {
                if (args.Value == Christmas)
                {
                    args.ForeColor   = Color.Chocolate;
                    args.ImageBounds = new Rectangle(2, 1, 24, 28);
                }
                if (args.Value == farwell)

                {
                    args.ForeColor = Color.Brown;
                }
                if (args.Value == Chris)

                {
                    args.ForeColor = Color.Red;
                }

                if (args.Value == newyear)

                {
                    args.ForeColor = Color.Blue;
                }
                if (args.Value == birthday)

                {
                    args.ForeColor = Color.GreenYellow;
                }
            }
        }