protected internal static object CoerceViewDateTime(DependencyObject d, object value) { var dp = (FXDatePicker)d; if (value != null) { var newValue = (DateTime)value; return(FXMonthView.ValidateDateRange(newValue)); } return(value); }
/// <summary> /// Clear the event, and detach our current EditableTextBox from ComboBox /// </summary> private void DetachFromVisualTree() { if (MonthView != null) { CommandManager.RemovePreviewExecutedHandler(MonthView, OnMonthViewCommandPreviewExecuted); MonthView.SelectedDateTimeChanged -= OnMonthViewDateTimeSelectionChanged; MonthView = null; } if (ValuePresenter != null) { ValuePresenter.MouseLeftButtonDown -= OnValuePresenterDoubleClick; } }
/// <summary> /// Detaches the EditableTextBox, MonthView from old child tree and attaches them to a new one /// </summary> private void AttachToVisualTree() { DetachFromVisualTree(); MonthView = GetTemplateChild(PART_MonthView) as FXMonthView; ValuePresenter = GetTemplateChild(PART_ValuePresenter) as TextBlock; if (MonthView != null) { CommandManager.AddPreviewExecutedHandler(MonthView, OnMonthViewCommandPreviewExecuted); MonthView.SelectedDateTimeChanged += OnMonthViewDateTimeSelectionChanged; } if (ValuePresenter != null) { ValuePresenter.MouseLeftButtonDown += OnValuePresenterDoubleClick; } RefreshDropDownButtonStyle(); }
private static void OnViewDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var dp = (FXDatePicker)d; FXMonthView.OnViewDateTimeChanged(dp.MonthView, e); }
/// <summary> /// Initializes a new instance of the FXMonthViewAutomationPeer class. /// </summary> /// <param name="owner">Owning MonthView control</param> public FXMonthViewAutomationPeer(FXMonthView owner) : base(owner) { }