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 class.
public EditableContentControl()
Properties
EditableContent
The content being edited.
public object? EditableContent { get; set; }
Property Value
Remarks
This property is for internal use only.
IsEditing
Indicates whether the content is currently being edited.
public bool IsEditing { get; set; }
Property Value
- bool:
trueif 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)
Invoked just before the IsKeyboardFocusWithinChanged event is raised by this element. Implement this method to add class handling for this event.
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | DependencyPropertyChangedEventArgs | A System.Windows.DependencyPropertyChangedEventArgs that contains the event data. |
OnKeyDown(KeyEventArgs)
Invoked when an unhandled System.Windows.Input.Keyboard.KeyDown attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
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
Defines the EditableContent property.
public static readonly DependencyProperty EditableContentProperty
IsEditingProperty
Defines the IsEditing property.
public static readonly DependencyProperty IsEditingProperty