コード例 #1
0
        private static void OnCurrentDateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CurrentDatePicker _this = d as CurrentDatePicker;

            if (_this == null)
            {
                return;
            }

            if (!(e.NewValue is bool))
            {
                return;
            }

            bool newUseCurrentDate = (bool)e.NewValue;

            if (newUseCurrentDate)
            {
                _this.UnderPicker.IsEnabled             = false;
                _this.WidenAnimation.KeyFrames[0].Value = _this.ControlRoot.ActualWidth;
                if (_this.ControlRoot.ActualWidth > 0)
                {
                    _this.ScaleUpBoxFrame.Value = _this.NarrowColumn.Width.Value / _this.ControlRoot.ActualWidth;
                }
                if (_this.Common.CurrentState.Name == _this.UseCurrentDateStateKey)
                {
                    VisualStateManager.GoToState(_this, _this.UseCurrentDateStateKey, false);
                }
                else
                {
                    VisualStateManager.GoToState(_this, _this.UseCurrentDateStateKey, true);
                }
            }
            else
            {
                _this.Date = DateTime.Today;
                _this.UnderPicker.IsEnabled = true;
                if (_this.ControlRoot.ActualWidth > 0)
                {
                    _this.ScaleDownBoxFrame.Value = _this.NarrowColumn.Width.Value / _this.ControlRoot.ActualWidth;
                }
                if (_this.Common.CurrentState.Name == _this.UseCustomDateStateKey)
                {
                    VisualStateManager.GoToState(_this, _this.UseCustomDateStateKey, false);
                }
                else
                {
                    VisualStateManager.GoToState(_this, _this.UseCustomDateStateKey, true);
                }
            }
        }
コード例 #2
0
        private static void OnDateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            CurrentDatePicker _this = d as CurrentDatePicker;

            if (_this == null)
            {
                return;
            }

            if (!(e.NewValue is DateTimeOffset))
            {
                return;
            }

            DateTimeOffset newDate = (DateTimeOffset)e.NewValue;

            _this.UnderPicker.Date = newDate;
        }