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
stylesheetStylesheetThe stylesheet to use for applying the style.
styleNamestringThe 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
styleNamestringThe 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
ButtonOk
Gets the OK button of the dialog.
[Browsable(false)]
public Button ButtonOk { get; }
Property Value
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
wWidgetThe 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
titlestringThe title of the message box.
contentWidgetThe 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
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
kKeysThe key that was pressed.
OnOk()
Called when the OK button is clicked. Override to handle OK action.
protected virtual void OnOk()