Button​Base Class

Definition

Represents the base class for all Button controls.

[System.Windows.Localizability(System.Windows.LocalizationCategory.Button)]
public abstract class ButtonBase : System.Windows.Controls.ContentControl, System.Windows.Input.ICommandSource
Inheritance
Derived
Attributes
Implements

Inherited Members

System.Object

System.Windows.Controls.ContentControl

System.Windows.Controls.Control

System.Windows.DependencyObject

System.Windows.FrameworkElement

System.Windows.Media.Visual

System.Windows.Threading.DispatcherObject

System.Windows.UIElement

Remarks

Handle the Click event to respond when the user clicks a ButtonBase. The user can raise the Click event by using an AccessText or by pressing ENTER or the SPACEBAR when the control has focus. When the user presses the SPACEBAR, the control sets IsPressed to true and captures the mouse. As a result, the control will raise mouse events such as MouseEnter and IsMouseDirectlyOverChanged. Note that using the AccessText or ENTER does not change IsPressed or capture the mouse, but it does raise the Click event.

The ButtonBase sets the AcceptsReturn attached property to true.

The ButtonBase sets the IsInputMethodEnabled property to false.

A ButtonBase is a ContentControl, which means that it can contain a single object of any type (such as a string, an image, or a panel). For more information, see the ContentControl class.

Constructors

Button​Base()

Initializes a new instance of the ButtonBase class.

Fields

Click​Event

Identifies the Click routed event.

Click​Mode​Property

Identifies the ClickMode dependency property.

Command​Parameter​Property

Identifies the CommandParameter dependency property.

Command​Property

Identifies the routed Command dependency property.

Command​Target​Property

Identifies the CommandTarget dependency property.

Is​Pressed​Property

Identifies the IsPressed dependency property.

Properties

Click​Mode

Gets or sets when the Click event occurs.

Command

Gets or sets the command to invoke when this button is pressed.

Command​Parameter

Gets or sets the parameter to pass to the Command property.

Command​Target

Gets or sets the element on which to raise the specified command.

Is​Enabled​Core

Gets the value of the IsEnabled property.

Is​Pressed

Gets a value that indicates whether a ButtonBase is currently activated.

Methods

On​Access​Key(​Access​Key​Event​Args)

Responds when the AccessKey for this control is called.

On​Click()

Raises the Click routed event.

On​Is​Pressed​Changed(​Dependency​Property​Changed​Event​Args)

Called when the IsPressed property changes.

On​Key​Down(​Key​Event​Args)

Provides class handling for the KeyDown routed event that occurs when the user presses a key while this control has focus.

On​Key​Up(​Key​Event​Args)

Provides class handling for the KeyUp routed event that occurs when the user releases a key while this control has focus.

On​Lost​Keyboard​Focus(​Keyboard​Focus​Changed​Event​Args)

Called when an element loses keyboard focus.

On​Lost​Mouse​Capture(​Mouse​Event​Args)

Provides class handling for the LostMouseCapture routed event that occurs when this control is no longer receiving mouse event messages.

On​Mouse​Enter(​Mouse​Event​Args)

Provides class handling for the ClickMode routed event that occurs when the mouse enters this control.

On​Mouse​Leave(​Mouse​Event​Args)

Provides class handling for the MouseLeave routed event that occurs when the mouse leaves an element.

On​Mouse​Left​Button​Down(​Mouse​Button​Event​Args)

Provides class handling for the MouseLeftButtonDown routed event that occurs when the left mouse button is pressed while the mouse pointer is over this control.

On​Mouse​Left​Button​Up(​Mouse​Button​Event​Args)

Provides class handling for the MouseLeftButtonUp routed event that occurs when the left mouse button is released while the mouse pointer is over this control.

On​Mouse​Move(​Mouse​Event​Args)

Provides class handling for the MouseMove routed event that occurs when the mouse pointer moves while over this element.

On​Render​Size​Changed(​Size​Changed​Info)

Called when the rendered size of a control changes.

Events

Click

Occurs when a Button is clicked.