Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ButtonBase.Click Event

Occurs when a Button is clicked.

Namespace: System.Windows.Controls.Primitives
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

public event RoutedEventHandler Click
/** @event */
public void add_Click (RoutedEventHandler value)

/** @event */
public void remove_Click (RoutedEventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
<object Click="RoutedEventHandler" .../>

Identifier Field


Routing Strategy




A button's Click event handles MouseLeftButtonDown and MouseRightButtonDown events. If an application author tries to attach an event handler for these events, they are never raised. For information on how to use these events see MouseLeftButtonDown and PreviewMouseRightButtonDown.

The following example shows how the Click event is used to handle button clicks.

<Button Name="btn1" Background="Pink" BorderBrush="Black" BorderThickness="1" Click="OnClick1">
<Button Name="btn2" Background="LightBlue" BorderBrush="Black" BorderThickness="1" Click="OnClick2">
<Button Name="btn3" Click="OnClick3">Reset</Button>

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
© 2018 Microsoft