Skip to main content
ButtonBase.Click event

Applies to Windows and Windows Phone

Occurs when a button control is clicked.

Syntax


public event RoutedEventHandler Click

Public Event Click As RoutedEventHandler

public:
event RoutedEventHandler^ Click {
   Windows::Foundation::EventRegistrationToken add(RoutedEventHandler^ value);
   void remove(Windows::Foundation::EventRegistrationToken token);
}

<button Click="eventhandler"/>

Event information

Delegate RoutedEventHandler

Examples

The following example demonstrates handling the Click event and setting the IsEnabled property of a Button, which inherits from ButtonBase.


<StackPanel>   
    <Button Content="Submit" 
            Click="submitButtonClick"/>
    <TextBlock x:Name="textBlock1"/>
</StackPanel>

void submitButtonClick(object sender, RoutedEventArgs e)
{
    textBlock1.Text = "You clicked the Submit button.";
}

    Private Sub submitButtonClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
        textBlock1.Text = "You clicked the Submit button."
    End Sub

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls.Primitives
Windows::UI::Xaml::Controls::Primitives [C++]

Metadata

Windows.winmd

See also

ButtonBase
Button