Represents a Windows button control, which reacts to the ButtonBase::Click event.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
The class inherits directly from the System.Windows.Controls.Primitives::ButtonBase class.
Handle the ButtonBase::Click event to respond when the user clicks a .
The OnMouseLeftButtonDown method marks the MouseLeftButtonDown event as handled. To respond to the MouseLeftButtonDown event, attach an event handler to the PreviewMouseLeftButtonDown event, or call AddHandler(RoutedEvent, Delegate, Boolean) with handledEventsToo set to true.
Dependency properties for this control might be set by the control’s default style. If a property is set by a default style, the property might change from its default value when the control appears in the application. The default style is determined by which desktop theme is used when the application is running. For more information, see Themes.
The following example shows three buttons that respond to clicks in three different ways.
Hover: the first button changes colors when the user hovers with the mouse over the button.
Press: the second button requires that the mouse be pressed while the mouse pointer is over the button.
Release: the third does not reset the background color of the buttons until the mouse is pressed and released on the button.
<Button Name="btn1" Background="Pink" BorderBrush="Black" BorderThickness="1" Click="OnClick1" ClickMode="Hover"> ClickMe1 </Button> <Button Name="btn2" Background="LightBlue" BorderBrush="Black" BorderThickness="1" Click="OnClick2" ClickMode="Press"> ClickMe2 </Button> <Button Name="btn3" Click="OnClick3" ClickMode="Release"> Reset </Button>
|How to: Create a Button That Has an Image||This example shows how to include an image on a .|
|How to: Create a Control That Has an Access Key and Text Wrapping||This example shows how to create a control that has an access key and supports text wrapping. The example uses a Label control to illustrate these concepts.|
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.