Пример #1
0
        /// <summary>
        /// Called when the editable text box loses focus.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance
        /// containing the event data.</param>
        private void OnEditableTextBoxLostFocus(object sender, RoutedEventArgs e)
        {
            TimeSpan duration;

            if (DurationHelper.StringToTimeSpan(this.Text, Language.GetEquivalentCulture(), out duration))
            {
                this.SelectedDuration = duration;
            }
            this.Text = DurationHelper.TimeSpanToString(Language.GetEquivalentCulture(), this.SelectedDuration);

        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DurationPicker"/> class.
        /// </summary>
        public DurationPicker()
        {

            this.Items.AddRange(values.Select(v => DurationHelper.TimeSpanToString(Language.GetEquivalentCulture(), v)));

        }
Пример #3
0
        /// <summary>
        /// Updates the text of the editable text box when <see cref="SelectedDuration"/> is changed.
        /// </summary>
        protected virtual void OnSelectedDurationChanged(DependencyPropertyChangedEventArgs args)
        {

            this.Text = DurationHelper.TimeSpanToString(Language.GetEquivalentCulture(), (TimeSpan)args.NewValue);

        }