Table of Contents

Class Dialog

Namespace
Myra.Graphics2D.UI
Assembly
Myra.dll

A window dialog with OK and Cancel buttons for user interaction.

public class Dialog : Window, IItemWithId, INotifyAttachedPropertyChanged, IContent
Inheritance
Dialog
Implements
Derived
Inherited Members

Constructors

Dialog(Stylesheet, string)

Initializes a new instance of the Dialog class with the specified stylesheet and style.

public Dialog(Stylesheet stylesheet, string styleName = "")

Parameters

stylesheet Stylesheet

The stylesheet to use for applying the style.

styleName string

The name of the style to apply. Defaults to the default stylesheet style.

Dialog(string)

Initializes a new instance of the Dialog class with the specified style.

public Dialog(string styleName = "")

Parameters

styleName string

The name of the style to apply. Defaults to the default stylesheet style.

Properties

ButtonCancel

Gets the Cancel button of the dialog.

[Browsable(false)]
public Button ButtonCancel { get; }

Property Value

Button

ButtonOk

Gets the OK button of the dialog.

[Browsable(false)]
public Button ButtonOk { get; }

Property Value

Button

ConfirmKey

Gets or sets the key that confirms the dialog (triggers the OK button).

public Keys ConfirmKey { get; set; }

Property Value

Keys

Methods

CanCloseByOk()

Determines whether the dialog can be closed by the OK button. Override to implement validation.

protected virtual bool CanCloseByOk()

Returns

bool

true if the dialog can close; otherwise false.

CopyFrom(Widget)

Copies properties from another Dialog widget.

protected override void CopyFrom(Widget w)

Parameters

w Widget

The Dialog widget to copy from.

CreateMessageBox(string, Widget)

Creates a message box dialog with the specified title and content widget.

public static Dialog CreateMessageBox(string title, Widget content)

Parameters

title string

The title of the message box.

content Widget

The content widget to display in the message box.

Returns

Dialog

A new Dialog configured as a message box.

CreateMessageBox(string, string)

Creates a message box dialog with the specified title and message text.

public static Dialog CreateMessageBox(string title, string message)

Parameters

title string

The title of the message box.

message string

The message text to display.

Returns

Dialog

A new Dialog configured as a message box with a text label.

OnKeyDown(Keys)

Handles key down events for the dialog, including confirm and close key shortcuts.

public override void OnKeyDown(Keys k)

Parameters

k Keys

The key that was pressed.

OnOk()

Called when the OK button is clicked. Override to handle OK action.

protected virtual void OnOk()