Edit

Share via


Button

A Button control reacts to user input from a mouse, keyboard, stylus, or other input device and raises a Click event. A Button is a basic UI component that can contain simple content such as text, and can also contain complex content such as images and Panel controls.

Screenshot showing buttons styled in different ways.

Title Description
Create a Button That Has an Image Learn how to add an image to a Button control.

Styles and templates

You can modify the default ControlTemplate to give the control a unique appearance. For more information about modifying a control's template, see What are styles and templates? and How to create a template for a control.

Content property

The content property for the Button control is Content. This property specifies the content displayed by the button, which can be simple text or complex UI elements.

Visual states

The following table lists the visual states for the Button control.

VisualState name VisualStateGroup name Description
Normal CommonStates The control is in its normal state.
MouseOver CommonStates The mouse pointer is positioned over the control.
Pressed CommonStates The control is pressed.
Disabled CommonStates The control is disabled.
Focused FocusStates The control has keyboard focus.
Unfocused FocusStates The control doesn't have keyboard focus.
Valid ValidationStates The control is valid and has no validation errors.
InvalidFocused ValidationStates The control has a validation error and has keyboard focus.
InvalidUnfocused ValidationStates The control has a validation error but doesn't have keyboard focus.

See also