Table of Contents

Class LiveEditor

Namespace
PluginUI
Assembly
PluginUI.dll

In-place layout editor. Mouse: click selects (Alt+click selects the parent), drag moves, the 8 handles resize. Keyboard: arrows nudge (Shift ×10, Ctrl resizes), Tab cycles siblings, Esc deselects, Ctrl+Z undoes, Ctrl+C copies the C# code of every edited element.

public sealed class LiveEditor
Inheritance
LiveEditor
Inherited Members

Remarks

Children of a Canvas are edited through Left/Top/ Width/Height; other elements through Margin and their explicit size. Give elements a Name to get usable generated code.

Properties

EditedElements

Elements modified since live edit started (or since ClearEdits()).

public IReadOnlyCollection<UIElement> EditedElements { get; }

Property Value

IReadOnlyCollection<UIElement>

ExitOnEscape

Esc with nothing selected leaves live edit (default true; designers keep the mode on).

public bool ExitOnEscape { get; set; }

Property Value

bool

GridSize

Snap grid in DIPs (0 = none). Hold Alt while dragging to bypass it.

public float GridSize { get; set; }

Property Value

float

IsEnabled

true while live editing.

public bool IsEnabled { get; }

Property Value

bool

Selected

Selected element.

public UIElement? Selected { get; set; }

Property Value

UIElement

ShowHelpBar

Shows the help bar at the bottom of the host (default true; designers turn it off).

public bool ShowHelpBar { get; set; }

Property Value

bool

ShowOutlines

Draws the outline of every element.

public bool ShowOutlines { get; set; }

Property Value

bool

Methods

ClearEdits()

Forgets the edit history.

public void ClearEdits()

GenerateCode()

C# statements reproducing the layout of every edited element.

public string GenerateCode()

Returns

string

Undo()

Undoes the last edit.

public bool Undo()

Returns

bool

Events

ElementEdited

Raised after an element was moved or resized.

public event Action<LiveEditor, UIElement>? ElementEdited

Event Type

Action<LiveEditor, UIElement>

SaveRequested

Raised by Ctrl+S. With a handler (for instance PluginUI.Design.LiveDesignBridge, which saves the layout to a .pluginui file), the help bar shows the shortcut.

public event Action<LiveEditor>? SaveRequested

Event Type

Action<LiveEditor>

SelectionChanged

Raised when the selection changes.

public event Action<LiveEditor, UIElement?>? SelectionChanged

Event Type

Action<LiveEditor, UIElement>