Class ButtonBase
Represents the base class for all button controls, such as Button, RepeatButton, and HyperlinkButton.
Inheritance
Inherited Members
Namespace: System.Windows.Controls.Primitives
Assembly: OpenSilver.dll
Syntax
public class ButtonBase : ContentControl, IControl, IFrameworkElement, IUIElement, IDependencyObject
Constructors
| Improve this Doc View SourceButtonBase()
Initializes a new instance of the ButtonBase class.
Declaration
public ButtonBase()
Fields
| Improve this Doc View SourceClickModeProperty
Identifies the ClickMode dependency property.
Declaration
public static readonly DependencyProperty ClickModeProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
CommandParameterProperty
Identifier for the CommandParameter dependency property.
Declaration
public static readonly DependencyProperty CommandParameterProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
CommandProperty
Identifier for the Command dependency property.
Declaration
public static readonly DependencyProperty CommandProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
IsFocusedProperty
Identifies the IsFocused dependency property.
Declaration
public static readonly DependencyProperty IsFocusedProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
IsMouseOverProperty
Identifies the IsMouseOver dependency property.
Declaration
public static readonly DependencyProperty IsMouseOverProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
IsPressedProperty
Identifies the IsPressed dependency property.
Declaration
public static readonly DependencyProperty IsPressedProperty
Field Value
Type | Description |
---|---|
DependencyProperty |
Properties
| Improve this Doc View SourceClickMode
Gets or sets when the Click event occurs.
Declaration
public ClickMode ClickMode { get; set; }
Property Value
Type | Description |
---|---|
ClickMode |
Command
Gets or sets the command to invoke when this button is pressed.
Declaration
public ICommand Command { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Input.ICommand | The command to invoke when this button is pressed. The default is null. |
CommandParameter
Gets or sets the parameter to pass to the Command property.
Declaration
public object CommandParameter { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The parameter to pass to the Command property. The default is null. |
IsFocused
Gets a value that determines whether the button has focus.
Declaration
public bool IsFocused { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the control has focus; otherwise, false. The default is false. |
IsMouseOver
Gets a value indicating whether the mouse pointer is located over this button control.
Declaration
public bool IsMouseOver { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true to indicate the mouse pointer is over the button control, otherwise false. The default is false. |
IsPressed
Gets a value that indicates whether a ButtonBase is currently in a pressed state.
Declaration
public bool IsPressed { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the ButtonBase is in a pressed state; otherwise false. The default is false. |
Methods
| Improve this Doc View SourceOnApplyTemplate()
Builds the visual tree for the ButtonBase control when a new template is applied.
Declaration
public override void OnApplyTemplate()
Overrides
| Improve this Doc View SourceOnClick()
Raises the Click event.
Declaration
protected virtual void OnClick()
OnGotFocus(RoutedEventArgs)
Called before the GotFocus event occurs.
Declaration
protected override void OnGotFocus(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnIsPressedChanged(DependencyPropertyChangedEventArgs)
Called when the value of the IsPressed property changes.
Declaration
protected virtual void OnIsPressedChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DependencyPropertyChangedEventArgs | e | The data for DependencyPropertyChangedEventArgs. |
OnKeyDown(KeyEventArgs)
Raises the KeyDown event
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
KeyEventArgs | e |
Overrides
| Improve this Doc View SourceOnKeyUp(KeyEventArgs)
Raises the KeyUp event
Declaration
protected override void OnKeyUp(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
KeyEventArgs | e |
Overrides
| Improve this Doc View SourceOnLostFocus(RoutedEventArgs)
Called before the LostFocus event occurs.
Declaration
protected override void OnLostFocus(RoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
RoutedEventArgs | e | The data for the event. |
Overrides
| Improve this Doc View SourceOnLostMouseCapture(MouseEventArgs)
Called before the LostMouseCapture event occurs to provide handling for the event in a derived class without attaching a delegate.
Declaration
protected override void OnLostMouseCapture(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | A MouseEventArgs that contains the event data. |
Overrides
| Improve this Doc View SourceOnMouseEnter(MouseEventArgs)
Raises the PointerEntered event
Declaration
protected override void OnMouseEnter(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e |
Overrides
| Improve this Doc View SourceOnMouseLeave(MouseEventArgs)
Raises the PointerExited event
Declaration
protected override void OnMouseLeave(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e |
Overrides
| Improve this Doc View SourceOnMouseLeftButtonDown(MouseButtonEventArgs)
Raises the PointerPressed event
Declaration
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseButtonEventArgs | e |
Overrides
| Improve this Doc View SourceOnMouseLeftButtonUp(MouseButtonEventArgs)
Raises the PointerReleased event
Declaration
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseButtonEventArgs | e |
Overrides
| Improve this Doc View SourceOnMouseMove(MouseEventArgs)
Raises the PointerMoved event
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e |
Overrides
Events
| Improve this Doc View SourceClick
Occurs when a Button is clicked.
Declaration
public event RoutedEventHandler Click
Event Type
Type | Description |
---|---|
RoutedEventHandler |