/// <summary> /// Changes the internal TextBlock and TextBox controls to visually hide the edit box. /// </summary> private void SwitchToTextBlock() { IsSelectionActiveDescriptor.RemoveValueChanged(this, OnIsSelectionActiveChanged); ctrlTextBox.Visibility = Visibility.Collapsed; ctrlTextBlock.Visibility = Visibility.Visible; }
/// <summary> /// Changes the internal TextBlock and TextBox controls to visually show the edit box. /// </summary> private void SwitchToTextBox() { ctrlTextBlock.Visibility = Visibility.Collapsed; ctrlTextBox.Text = ctrlTextBlock.Text; ctrlTextBox.CaretIndex = 0; ctrlTextBox.Visibility = Visibility.Visible; ctrlTextBox.Focus(); ctrlTextBox.Select(0, ctrlTextBox.Text.Length); // Install a handler to be notifed if we're part of a selection and the selection control looses focus. IsSelectionActiveDescriptor.AddValueChanged(this, OnIsSelectionActiveChanged); }