ButtonBase.Click Evento
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Ocorre quando um controle de botão é clicado.
// Register
event_token Click(RoutedEventHandler const& handler) const;
// Revoke with event_token
void Click(event_token const* cookie) const;
// Revoke with event_revoker
ButtonBase::Click_revoker Click(auto_revoke_t, RoutedEventHandler const& handler) const;
C#
public event RoutedEventHandler Click;
function onClick(eventArgs) { /* Your code */ }
buttonBase.addEventListener("click", onClick);
buttonBase.removeEventListener("click", onClick);
- or -
buttonBase.onclick = onClick;
Public Custom Event Click As RoutedEventHandler
XAML
<button Click="eventhandler"/>
O exemplo a seguir demonstra como manipular o evento Click e definir a propriedade IsEnabled de um Button, que herda de ButtonBase.
XAML
<StackPanel>
<Button Content="Submit"
Click="submitButtonClick"/>
<TextBlock x:Name="textBlock1"/>
</StackPanel>
C#
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
Produto | Versões |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |