In This Article

CommandButton Class

Defines a custom command button control.

public class CommandButton : UIControl, IUIControl, IUIElement, ILogicalTreeNode, IDpiAwareElement, IDisposable
Inheritance:
object MarshalByRefObject Component Control ScrollableControl UIControl object
Implements:
IUIControl IUIElement ILogicalTreeNode IDpiAwareElement IDisposable

Constructors

CommandButton()

Initializes an instance of the class.

public CommandButton()

Properties

CanDrawStates

Indicates whether the button can draw states.

public bool CanDrawStates { get; set; }

Property Value

bool:

true if the button can draw states; otherwise, false.

CaptureMouseWhenPressed

Indicates whether to automatically capture the mouse when the element is pressed.

protected override bool CaptureMouseWhenPressed { get; }

Property Value

bool:

true if the mouse should automatically be captured when the element is pressed; otherwise, false.

Command

The ICommand for the button.

public ICommand? Command { get; set; }

Property Value

ICommand

Image

The image.

public Image? Image { get; set; }

Property Value

Image

IsCheckable

Indicates whether the button is checkable.

public bool IsCheckable { get; set; }

Property Value

bool:

true if the button is checkable; otherwise, false.

IsChecked

Indicates whether the button is checked.

public bool IsChecked { get; set; }

Property Value

bool:

true if the button is checked; otherwise, false.

Methods

OnEnabledChanged(EventArgs)

Raises the EnabledChanged event.

protected override void OnEnabledChanged(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

OnGotFocus(EventArgs)

Raises the GotFocus event.

protected override void OnGotFocus(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

OnLostFocus(EventArgs)

Raises the LostFocus event.

protected override void OnLostFocus(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

OnMouseDown(MouseEventArgs)

Raises the MouseDown event.

protected override void OnMouseDown(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

A MouseEventArgs that contains the event data.

OnMouseEnter(EventArgs)

Raises the MouseEnter event.

protected override void OnMouseEnter(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

OnMouseLeave(EventArgs)

Raises the MouseLeave event.

protected override void OnMouseLeave(EventArgs e)
Parameter Type Description
e EventArgs

An EventArgs that contains the event data.

OnMouseUp(MouseEventArgs)

Raises the MouseUp event.

protected override void OnMouseUp(MouseEventArgs e)
Parameter Type Description
e MouseEventArgs

A MouseEventArgs that contains the event data.

OnParentChanged()

Invoked when the logical parent is changed. This is invoked after the parent has changed, and the purpose is to allow elements to perform actions based on the changed parent.

protected override void OnParentChanged()

OnRender(PaintEventArgs)

Renders the element.

protected override void OnRender(PaintEventArgs e)
Parameter Type Description
e PaintEventArgs

The event data.

ProcessCmdKey(ref Message, Keys)

Processes a command key.

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
Parameter Type Description
msg Message

A Message, passed by reference, that represents the window message to process.

keyData Keys

One of the Keys values that represents the key to process.

Returns

bool:

true if the character was processed by the control; otherwise, false.

Inherited Members

Extension Methods