Exemplo n.º 1
0
        public Window2()
        {
            InitializeComponent();
            SfSkinManager.SetVisualStyle(this, VisualStyles.MaterialLight);

            this.Loaded += (sender, e) =>
            {
                foreach (DateTimeEdit dateTimeEdit in FindVisualChildren <DateTimeEdit>(this))
                {
                    dateTimeEdit.Loaded += (s, args) =>
                    {
                        if (dateTimeEdit.Name == "blackOutDates")
                        {
                            Syncfusion.Windows.Controls.CalendarDateRange blackOutDays = new Syncfusion.Windows.Controls.CalendarDateRange();
                            DateTime StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                            /*DateTime.DaysInMonth(CurrentDateTime.Year, CurrentDateTime.Month)*/
                            DateTime EndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day - 2);
                            blackOutDays = new Syncfusion.Windows.Controls.CalendarDateRange()
                            {
                                Start = StartDate, End = EndDate
                            };
                            Syncfusion.Windows.Controls.Calendar calendar = dateTimeEdit.DateTimeCalender as Syncfusion.Windows.Controls.Calendar;
                            calendar.BlackoutDates.Add(blackOutDays);
                        }
                    };
                    dateTimeEdit.GotFocus += (s, args) =>
                    {
                        focusedDateTimeEdit = s as DateTimeEdit;

                        if (focusedDateTimeEdit == patternDT)
                        {
                            cmbopattern.IsEnabled = true;
                        }
                        else
                        {
                            cmbopattern.IsEnabled = false;
                        }

                        if (focusedDateTimeEdit == cultureDT)
                        {
                            comboculture.IsEnabled = true;
                        }
                        else
                        {
                            comboculture.IsEnabled = false;
                        }

                        if (focusedDateTimeEdit == validationDT || focusedDateTimeEdit == minDateTime || focusedDateTimeEdit == maxDateTime)
                        {
                            minDateTime.IsEnabled = true;
                        }
                        else
                        {
                            minDateTime.IsEnabled = false;
                        }
                    };
                }
            };
        }
Exemplo n.º 2
0
        private void loadedCommandChanged(object obj)
        {
            DateTimeEdit dateTimeEdit = obj as DateTimeEdit;
            //Setting start and end range for blocking dates
            DateTime StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 1);
            DateTime EndDate   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day - 1);

            Syncfusion.Windows.Controls.CalendarDateRange blackOutDays = new Syncfusion.Windows.Controls.CalendarDateRange()
            {
                Start = StartDate,
                End   = EndDate
            };
            Syncfusion.Windows.Controls.Calendar calendar = dateTimeEdit.DateTimeCalender as Syncfusion.Windows.Controls.Calendar;
            calendar.BlackoutDates.Add(blackOutDays);
        }