Table of Contents

Class StructureEditor<T>

Namespace
NanoByte.StructureEditor.WinForms
Assembly
NanoByte.StructureEditor.WinForms.dll

An editor for hierarchical structures.

public class StructureEditor<T> : UserControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl, IStructureEditor<T> where T : class, IEquatable<T>

Type Parameters

T

The type of object to edit.

Inheritance
StructureEditor<T>
Implements
Inherited Members

Remarks

Derive and call DescribeRoot(string) or DescribeRoot<TEditor>(string) as well as Describe<TContainer>() in the constructor.

Constructors

StructureEditor()

Creates a new structure editor for a T with a parameterless constructor.

public StructureEditor()

StructureEditor(Func<T>)

Creates a new structure editor.

public StructureEditor(Func<T> factory)

Parameters

factory Func<T>

Callback to create a new instance of T.

Properties

CommandManager

Holds the object being editing and manages undo/redo operations on it.

public ICommandManager<T> CommandManager { get; }

Property Value

ICommandManager<T>

Methods

DescribeRoot(string)

Set up handling for the root element with a generic editor.

public IContainerDescription<T> DescribeRoot(string name)

Parameters

name string

The name of the root element.

Returns

IContainerDescription<T>

The ContainerDescription<TContainer> for use in a "Fluent API" style.

DescribeRoot<TEditor>(string)

Set up handling for the root element with a custom editor.

public IContainerDescription<T> DescribeRoot<TEditor>(string name) where TEditor : INodeEditor<T>, new()

Parameters

name string

The name of the root element.

Returns

IContainerDescription<T>

The ContainerDescription<TContainer> for use in a "Fluent API" style.

Type Parameters

TEditor

An editor for modifying the content of the root.

Describe<TContainer>()

Adds a ContainerDescription<TContainer> used to describe the structure of the data being editing.

public IContainerDescription<TContainer> Describe<TContainer>() where TContainer : class

Returns

IContainerDescription<TContainer>

The ContainerDescription<TContainer> for use in a "Fluent API" style.

Type Parameters

TContainer

The type of the container to describe.

GetSerialized()

Returns the serialized representation of the selected StructureTreeNode.

protected virtual string GetSerialized()

Returns

string

Open(ICommandManager<T>)

Opens an object for editing using the specified ICommandManager<T>.

public void Open(ICommandManager<T> commandManager)

Parameters

commandManager ICommandManager<T>

Holds the object being editing and manages undo/redo operations on it.

Redo()

Redoes the last action.

public void Redo()

Remove()

Removes the currently selected entry.

public void Remove()

Undo()

Undoes the last action.

public void Undo()