Class PanelOkCancelButtons
Panel with Ok, Cancel and Apply buttons.
[ControlCategory("Containers")]
public class PanelOkCancelButtons : StackPanel, IBaseObjectWithAttr, IBaseObjectWithId, INotifyPropertyChanged, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, ILayoutItem, INotifyDataErrorInfo
- Inheritance
-
PanelOkCancelButtons
- Implements
Remarks
Example of how a PanelOkCancelButtons can look:

Constructors
- PanelOkCancelButtons()
Initializes a new instance of the PanelOkCancelButtons class. This constructor creates a panel with 'Ok' and 'Cancel' buttons.
- PanelOkCancelButtons(Control)
Initializes a new instance of the PanelOkCancelButtons class. This constructor creates a panel with 'Ok' and 'Cancel' buttons.
- PanelOkCancelButtons(CreateParameters)
Initializes a new instance of the PanelOkCancelButtons class with specified parameters.
- PanelOkCancelButtons(bool)
Initializes a new instance of the PanelOkCancelButtons class with options to automatically create standard buttons.
Properties
- ApplyButton
Gets 'Apply' button.
- ButtonClickedAction
Gets or sets an action to be executed when a button is clicked.
- CancelButton
Gets 'Cancel' button.
- DefaultButtonMargin
Gets or sets default margin for the buttons.
- LastButtonClicked
Gets the last button that was clicked, if any.
- LastClickedAsDialogResult
Gets the DialogResult corresponding to the last button clicked.
- OkButton
Gets 'Ok' button.
- ShowApplyButton
Gets or sets whether 'Apply' button is visible.
- ShowCancelButton
Gets or sets whether 'Cancel' button is visible.
- ShowOkButton
Gets or sets whether 'Ok' button is visible.
- UseModalResult
Gets or sets whether 'Ok' and 'Cancel' buttons change ModalResult when they are clicked. Default is
false.
- VisibleButtonCount
Gets the number of buttons that are currently visible.
- VisibleButtons
Gets an enumerable collection of buttons that are currently visible.
Methods
- AddButton(KnownButton, Action?)
Adds a new button to the current container with the specified behavior.
- AddButton(string, Action?)
Adds a new button with the specified text and click action to the panel.
- ApplyModalResult(ModalResult)
Applies the modal result to the parent window if it is a dialog.
- CreateButton(string)
Creates a button with the specified text. Override this method to customize button creation.
- CreateWithButtons(params KnownButton[])
Creates a PanelOkCancelButtons instance with specified buttons.
- CreateWithButtons(MessageBoxButtons)
Creates a PanelOkCancelButtons instance with the specified button configuration.
- GetButton(KnownButton)
Retrieves a button from the collection of children that matches the specified known button identifier.
- GetDefaultButton()
Gets the default button from the collection of child buttons.
- GetVisibleButton(int)
Retrieves the button at the specified index from the collection of visible buttons.
- HandleApplyButtonClick(object?, EventArgs)
Called when 'Apply' button is clicked.
- HandleCancelButtonClick(object?, EventArgs)
Called when 'Cancel' button is clicked.
- HandleOkButtonClick(object?, EventArgs)
Called when 'Ok' button is clicked.
- OnButtonClicked(KnownButton?)
Invoked when a button is clicked.
- ResetButtonsText()
Resets the text of all button controls within the panel to their default values.
- SetButtonText(KnownButton, string?)
Sets the text of a specified button.
- SetButtons(params KnownButton[])
Configures the visibility of buttons based on the specified set of known buttons.
- SetButtons(MessageBoxButtons)
Configures the panel with the specified button layout.
- SetCancelButtonExclusive(Button?)
Sets the specified button as the exclusive cancel button within the collection of child buttons.
- SetCancelButtonExclusive(KnownButton)
Sets the specified button as the exclusive cancel button.
- SetCancelButtonExclusive(MessageBoxButtons)
Sets the specified button as the exclusive cancel button for the panel.
- SetDefaultButtonExclusive(Button?)
Sets the specified button as the default button, ensuring that no other buttons are marked as default.
- SetDefaultButtonExclusive(KnownButton)
Sets the specified button as the default button, ensuring it is the only default button.
- SetDefaultButtonExclusive(MessageBoxDefaultButton)
Sets the default button for the panel exclusively based on the specified button value.
- SetDefaultButtonExclusive(int)
Sets the specified button as the default button, ensuring it is the only default button.
- TrySetCancelButtonExclusive(KnownButton[])
Sets the cancel button to be exclusive among the specified known buttons.
Events
- ApplyButtonClick
Occurs when the 'Apply' button is clicked.
- ButtonClicked
Occurs when any button is clicked.
- CancelButtonClick
Occurs when the 'Cancel' button is clicked.
- OkButtonClick
Occurs when the 'Ok' button is clicked.