private void RemoveTextbox(CustomTextBox textbox) { if (textbox != null) { graphCanvas.RemoveTextBox(textbox); textbox.Visibility = Visibility.Collapsed; if (this.editTextbox == textbox) this.editTextbox = null; } }
private void CreateEditTextbox(bool allowNewLine, SolidColorBrush backgroundColor, String font, FontWeight weight, double fontSize, double minTextboxWidth) { editTextbox = new CustomTextBox(graphCanvas, allowNewLine, backgroundColor, font, weight, fontSize, Configurations.TextboxMaxWidth, minTextboxWidth); graphCanvas.AddTextbox(editTextbox); editTextbox.Visibility = Visibility.Visible; editTextbox.PreviewKeyDown += OnInternalTextboxPreviewKeyDown; editTextbox.InternalTextBox.TextChanged += new TextChangedEventHandler(OnInternalTextBoxTextChanged); editTextbox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(OnInternalTextBoxLostKeyboardFocus); }