private void UpdateDays(int year, int month) { if (_dayPresenter == null) { return; } CurrentYear = year; CurrentMonth = month; BindingUtils.BindingProperty(_dayPresenter, CalendarXDayPresenter.ModeProperty, this, ModeProperty); BindingUtils.BindingProperty(_dayPresenter, CalendarXDayPresenter.FirstDayOfWeekProperty, this, FirstDayOfWeekProperty); BindingUtils.BindingProperty(_dayPresenter, CalendarXDayPresenter.MinDateProperty, this, MinDateProperty); BindingUtils.BindingProperty(_dayPresenter, CalendarXDayPresenter.MaxDateProperty, this, MaxDateProperty); BindingUtils.BindingProperty(_dayPresenter, CalendarXDayPresenter.IsTodayHighlightedProperty, this, IsTodayHighlightedProperty); _dayPresenter.Mode = Mode; _dayPresenter.FirstDayOfWeek = FirstDayOfWeek; _dayPresenter.MinDate = MinDate; _dayPresenter.MaxDate = MaxDate; _dayPresenter.IsTodayHighlighted = IsTodayHighlighted; try { var date = new DateTime(CurrentYear, CurrentMonth, 1); _dayPresenter.Update(date.Year, date.Month, SelectedDates); } catch { } }
protected override void PrepareContainerForItemOverride(DependencyObject d, object item) { var element = d as FormGroupControl; var formGroup = item as FormGroup; BindingUtils.BindingProperty(element, FormGroupControl.HeaderProperty, formGroup, FormGroup.HeaderProperty); BindingUtils.BindingProperty(element, FormGroupControl.HeaderTemplateProperty, formGroup, FormGroup.HeaderTemplateProperty); BindingUtils.BindingProperty(element, FormGroupControl.HeaderTemplateSelectorProperty, formGroup, FormGroup.HeaderTemplateSelectorProperty); BindingUtils.BindingProperty(element, FormGroupControl.RowSpacingProperty, Form, Form.RowSpacingProperty); BindingUtils.BindingProperty(element, FormGroupControl.HeaderHeightProperty, formGroup, FormGroup.HeaderHeightProperty, Form, Form.HeaderHeightProperty); BindingUtils.BindingProperty(element, FormGroupControl.HeaderWidthProperty, formGroup, FormGroup.HeaderWidthProperty, Form, Form.HeaderWidthProperty); BindingUtils.BindingProperty(element, FormGroupControl.HeaderPaddingProperty, formGroup, FormGroup.HeaderPaddingProperty, Form, Form.HeaderPaddingProperty); BindingUtils.BindingProperty(element, FormGroupControl.HeightProperty, formGroup, FormGroup.HeightProperty, Form, Form.RowHeightProperty); //if(formGroup is FormTemplateGroup) //{ // var formTemplateGroup = formGroup as FormTemplateGroup; // element.SetValue(FormGroupControl.ContentTemplateProperty, formTemplateGroup.ContentTemplate); // element.SetValue(FormGroupControl.ContentTemplateSelectorProperty, formTemplateGroup.ContentTemplateSelector); //} //else if (formGroup is FormTextGroup) { var formTextGroup = formGroup as FormTextGroup; element.SetValue(FormGroupControl.ContentTemplateProperty, CreateTextBoxTemplate(formTextGroup.TextBoxStyle, formTextGroup)); } element.ActualHeaderWidthChanged += delegate { formGroup.ActualHeaderWidth = element.ActualHeaderWidth; }; }
protected override void PrepareContainerForItemOverride(DependencyObject element, object item) { var calendarXItem = element as CalendarXItem; BindingUtils.BindingProperty(calendarXItem, CalendarXItem.ContentProperty, item, CalendarXItemModel.ContentProperty); BindingUtils.BindingProperty(calendarXItem, CalendarXItem.IsCheckedProperty, item, CalendarXItemModel.IsCheckedProperty, System.Windows.Data.BindingMode.TwoWay); BindingUtils.BindingProperty(calendarXItem, CalendarXItem.IsDownplayProperty, item, CalendarXItemModel.IsDownplayProperty); BindingUtils.BindingProperty(calendarXItem, CalendarXItem.IsTodayProperty, item, CalendarXItemModel.IsTodayProperty); BindingUtils.BindingProperty(calendarXItem, CalendarXItem.IsInRangeProperty, item, CalendarXItemModel.IsInRangeProperty); BindingUtils.BindingProperty(calendarXItem, CalendarXItem.IsEnabledProperty, item, CalendarXItemModel.IsEnabledProperty); }
private void UpdateBinding() { if (Source != null) { BindingUtils.BindingProperty(this, HeightProperty, Source, IconHelper.HeightProperty); BindingUtils.BindingProperty(this, WidthProperty, Source, IconHelper.WidthProperty); BindingUtils.BindingProperty(this, MinWidthProperty, Source, IconHelper.MinWidthProperty); BindingUtils.BindingProperty(this, MinHeightProperty, Source, IconHelper.MinHeightProperty); BindingUtils.BindingProperty(this, MaxWidthProperty, Source, IconHelper.MaxWidthProperty); BindingUtils.BindingProperty(this, MaxHeightProperty, Source, IconHelper.MaxHeightProperty); BindingUtils.BindingProperty(this, MarginProperty, Source, IconHelper.MarginProperty); BindingUtils.BindingProperty(this, PaddingProperty, Source, IconHelper.PaddingProperty); BindingUtils.BindingProperty(this, FontFamilyProperty, Source, IconHelper.FontFamilyProperty); BindingUtils.BindingProperty(this, ForegroundProperty, Source, IconHelper.ForegroundProperty); BindingUtils.BindingProperty(this, FontSizeProperty, Source, IconHelper.FontSizeProperty); BindingUtils.BindingProperty(this, VisibilityProperty, this, ContentProperty, new NullToCollapseConverter()); } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); _secondPresenter = Template?.FindName("PART_SecondPresenter", this) as TimeSelectorSecondPresenter; BindingUtils.BindingProperty(_secondPresenter, TimeSelectorSecondPresenter.TimeSelectorItemStyleProperty, this, TimeSelectorItemStyleProperty, BindingMode.OneWay, UpdateSourceTrigger.PropertyChanged); _minutePresenter = Template?.FindName("PART_MinutePresenter", this) as TimeSelectorMinutePresenter; BindingUtils.BindingProperty(_minutePresenter, TimeSelectorMinutePresenter.TimeSelectorItemStyleProperty, this, TimeSelectorItemStyleProperty, BindingMode.OneWay, UpdateSourceTrigger.PropertyChanged); _hourPresenter = Template?.FindName("PART_HourPresenter", this) as TimeSelectorHourPresenter; BindingUtils.BindingProperty(_hourPresenter, TimeSelectorHourPresenter.TimeSelectorItemStyleProperty, this, TimeSelectorItemStyleProperty, BindingMode.OneWay, UpdateSourceTrigger.PropertyChanged); _secondPresenter.Selected += SecondPresenter_Selected; _minutePresenter.Selected += MinutePresenter_Selected; _hourPresenter.Selected += HourPresenter_Selected; _hourPresenter.Unselected += HourPresenter_Unselected; UpdateSeconds(); UpdateMinutes(); UpdateHours(); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); _backwardButton = Template?.FindName("PART_BackwardButton", this) as RepeatButton; _backwardButton.Click += BackwardButton_Click; _previousButton = Template?.FindName("PART_PreviousButton", this) as RepeatButton; _previousButton.Click += PreviousButton_Click; _nextButton = Template?.FindName("PART_NextButton", this) as RepeatButton; _nextButton.Click += NextButton_Click; _forwardButton = Template?.FindName("PART_ForwardButton", this) as RepeatButton; _forwardButton.Click += ForwardButton_Click; _yearButton = Template?.FindName("PART_YearButton", this) as Button; BindingUtils.BindingProperty(_yearButton, Button.ContentProperty, this, CurrentYearProperty, "D4"); _yearButton.Click += YearButton_Click; _monthButton = Template?.FindName("PART_MonthButton", this) as Button; BindingUtils.BindingProperty(_monthButton, Button.ContentProperty, this, CurrentMonthProperty, new LocalizedMonthStringConverter()); _monthButton.Click += MonthButton_Click; _weekPresenter = Template?.FindName("PART_WeekPresenter", this) as CalendarXWeekPresenter; BindingUtils.BindingProperty(_weekPresenter, CalendarXWeekPresenter.FirstDayOfWeekProperty, this, FirstDayOfWeekProperty); _dayPresenter = Template?.FindName("PART_DayPresenter", this) as CalendarXDayPresenter; BindingUtils.BindingProperty(_dayPresenter, CalendarXDayPresenter.ItemContainerStyleProperty, this, CalendarXItemStyleProperty); _monthPresenter = Template?.FindName("PART_MonthPresenter", this) as CalendarXMonthPresenter; BindingUtils.BindingProperty(_monthPresenter, CalendarXMonthPresenter.ItemContainerStyleProperty, this, CalendarXItemStyleProperty); _yearPresenter = Template?.FindName("PART_YearPresenter", this) as CalendarXYearPresenter; BindingUtils.BindingProperty(_yearPresenter, CalendarXYearPresenter.ItemContainerStyleProperty, this, CalendarXItemStyleProperty); _dayPresenter.Selected += DayPresenter_Selected; _dayPresenter.Unselected += DayPresenter_Unselected; _monthPresenter.Selected += MonthPresenter_Selected; _monthPresenter.Unselected += MonthPresenter_Unselected; _yearPresenter.Selected += YearPresenter_Selected; _yearPresenter.Unselected += YearPresenter_Unselected; _weekPresenter.UpdateWeeks(); var dayDate = SelectedDate ?? DateTime.Now.Date; UpdateDays(dayDate.Year, dayDate.Month); UpdateMonths(dayDate.Year, dayDate.Month); UpdateYears(dayDate.Year, dayDate.Month); }