Export (0) Print
Expand All

ButtonBase.Click Event

Occurs when a Button is clicked.

Namespace: System.Windows.Controls.Primitives
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

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

ClickEvent

Routing Strategy

Bubbling

Delegate

RoutedEventHandler

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">
  ClickMe1
</Button>
<Button Name="btn2" Background="LightBlue" BorderBrush="Black" BorderThickness="1" Click="OnClick2">
  ClickMe2
</Button>
<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

Community Additions

ADD
Show:
© 2014 Microsoft