In This Article

EditableContentControl Class

Represents a control that displays content by default but can toggle to an editable mode for editing the content.

public class EditableContentControl : ContentControl
Inheritance:
object Visual UIElement FrameworkElement Control ContentControl object
Derived:
ShellEditableContentControl

Constructors

EditableContentControl()

Initializes an instance of the EditableContentControl class.

public EditableContentControl()

Properties

EditableContent

Gets or sets the content being edited.

public object EditableContent { get; set; }

Property Value

object:

The content being edited.

Remarks

This property is for internal use only.

IsEditing

Gets or sets whether the content is currently being edited.

public bool IsEditing { get; set; }

Property Value

bool:

true if the content is currently being edited; otherwise, false.

Remarks

This property toggles the UI of the control between display and edit modes.

Methods

OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs)

Occurs when the property value has changed.

protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
Parameter Type Description
e DependencyPropertyChangedEventArgs

The System.Windows.DependencyPropertyChangedEventArgs containing data related to this event.

OnKeyDown(KeyEventArgs)

Occurs when a key is pressed.

protected override void OnKeyDown(KeyEventArgs e)
Parameter Type Description
e KeyEventArgs

The KeyEventArgs that contains the event data.

SelectText(TextBox)

Selects the text in the specified TextBox when editing starts.

protected virtual void SelectText(TextBox textBox)
Parameter Type Description
textBox TextBox

The TextBox to update.

Remarks

The default implementation of this method selects all text. Override it to select a range of text instead, such as a filename's actual name range before the extension.

SetContentAfterEditing(object)

Sets the Content property with the specified edited content following a committed edit.

protected virtual void SetContentAfterEditing(object editedContent)
Parameter Type Description
editedContent object

The EditableContent value prior to editing ending.

Fields

EditableContentProperty

Identifies the EditableContent dependency property. This field is read-only.

public static readonly DependencyProperty EditableContentProperty

IsEditingProperty

Identifies the IsEditing dependency property. This field is read-only.

public static readonly DependencyProperty IsEditingProperty