Пример #1
0
 public TimespanTextbox(TextBox textBox)
 {
     _textBox                  = textBox;
     _formatString             = DefaultMask;
     textBox.PreviewTextInput += OnTextInput;
     textBox.PreviewKeyDown   += OnPreviewKeyDown;
     textBox.SelectionChanged += OnSelectionChanged;
     DataObject.AddPastingHandler(textBox, OnPaste);
     _timerFormat = GetTimeFormat(textBox);             //Get default
 }
Пример #2
0
        public TimespanTextbox(TextBox textBox)
        {
            _textBox                  = textBox;
            _formatString             = DefaultMask;
            textBox.PreviewTextInput += OnTextInput;
            textBox.PreviewKeyDown   += OnPreviewKeyDown;
            textBox.SelectionChanged += OnSelectionChanged;
            DataObject.AddPastingHandler(textBox, OnPaste);
            _timerFormat = GetTimeFormat(textBox);             //Get default

            //Disable the possibility to drag text inside the textBox, because bad things were happening....
            DataObject.AddCopyingHandler(_textBox, (sender, e) => { if (e.IsDragDrop)
                                                                    {
                                                                        e.CancelCommand();
                                                                    }
                                         });
        }
Пример #3
0
 public static void SetTimeFormat(Control o, TimerFormats TimeFormat)
 {
     o.SetValue(TimeFormatProperty, TimeFormat);
 }
Пример #4
0
 private void TimeFormatChanged(TimerFormats timerFormat)
 {
     _timerFormat = timerFormat;
     MaxTimeSpanChanged(_maxTimeSpan);
 }