/// <summary> /// Change text. /// </summary> /// <param name="type">The type of text change that will occur.</param> /// <param name="text">The new value of the text.</param> /// <returns>A value indicating if the event was handled.</returns> private bool textChange(TextChangedType type, string text) { // Raise the PreviewTextChanged event PreviewTextChangedEventArgs e = new PreviewTextChangedEventArgs(PreviewTextChangedEvent, type, text); OnPreviewTextChanged(e); // Return a value indicating if the event was handled return(e.Handled); }
protected override void OnPreviewTextChanged(PreviewTextChangedEventArgs e) { if (!String.IsNullOrEmpty(Watermark) && IsWatermarkShown) { this.IsWatermarkShown = false; this.Text = " "; e.Handled = true; this.SelectionStart = 1; } base.OnPreviewTextChanged(e); }
/// <summary> /// Raise a PreviewTextChanged event. /// </summary> /// <param name="e">The event arguments.</param> protected virtual void OnPreviewTextChanged(PreviewTextChangedEventArgs e) { RaiseEvent(e); }