Table of Contents

Class FilePathBox

Namespace
PluginUI
Assembly
PluginUI.dll

Path field with a browse button: shows the path with a middle ellipsis, opens the native file/folder dialog and accepts files dropped from Explorer (sample loaders, IR loaders, export folders).

public class FilePathBox : Control
Inheritance
FilePathBox
Inherited Members

Constructors

FilePathBox()

Creates a path box.

public FilePathBox()

Properties

DefaultExtension

Default extension for SaveFile (without dot).

public string? DefaultExtension { get; set; }

Property Value

string

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

DialogTitle

Title of the file dialog (null = localized FileDialogTitle, "Select").

public string? DialogTitle { get; set; }

Property Value

string

Filters

File type filters of the dialog.

public IReadOnlyList<FileFilter>? Filters { get; set; }

Property Value

IReadOnlyList<FileFilter>

Mode

Selection mode.

public FilePathMode Mode { get; set; }

Property Value

FilePathMode

Path

Selected path (null = none).

public string? Path { get; set; }

Property Value

string

Placeholder

Text shown when no path is selected (null = localized NoFile, "No file").

public string? Placeholder { get; set; }

Property Value

string

ShowFileNameOnly

Shows only the file name instead of the full path.

public bool ShowFileNameOnly { get; set; }

Property Value

bool

Validate

Validates dropped or chosen paths (default: existing file for files, existing folder for folders, and the extension list of Filters).

[Browsable(false)]
public Func<string, bool>? Validate { get; set; }

Property Value

Func<string, bool>

Methods

Browse()

Opens the dialog for the current mode.

public void Browse()

MiddleEllipsis(string, TextStyle, float)

Shortens text with "…" in the middle so that it fits maxWidth.

protected string MiddleEllipsis(string text, TextStyle style, float maxWidth)

Parameters

text string
style TextStyle
maxWidth float

Returns

string

OnCaptureLost()

The mouse capture was lost without a button release.

protected override void OnCaptureLost()

OnFilesDropped(FilesDroppedEventArgs)

Files dropped from the shell (requires AllowFileDrop on this element or an ancestor).

protected override void OnFilesDropped(FilesDroppedEventArgs e)

Parameters

e FilesDroppedEventArgs

OnKeyDown(KeyEventArgs)

Key pressed while focused (bubbles to parents).

protected override void OnKeyDown(KeyEventArgs e)

Parameters

e KeyEventArgs

OnMouseDown(MouseEventArgs)

Mouse button pressed over the element (or captured).

protected override void OnMouseDown(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseLeave()

The mouse left the element.

protected override void OnMouseLeave()

OnMouseMove(MouseEventArgs)

Mouse moved over the element (or captured).

protected override void OnMouseMove(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseUp(MouseEventArgs)

Mouse button released.

protected override void OnMouseUp(MouseEventArgs e)

Parameters

e MouseEventArgs

RenderVector(DrawingContext, Rect, VectorStyle)

Vector rendering of the widget area.

protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)

Parameters

dc DrawingContext
widget Rect
style VectorStyle

Events

PathChanged

Raised when the path changes (dialog, drop or code).

public event Action<FilePathBox, string?>? PathChanged

Event Type

Action<FilePathBox, string>