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 }
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(); } }); }
public static void SetTimeFormat(Control o, TimerFormats TimeFormat) { o.SetValue(TimeFormatProperty, TimeFormat); }
private void TimeFormatChanged(TimerFormats timerFormat) { _timerFormat = timerFormat; MaxTimeSpanChanged(_maxTimeSpan); }