- Mastering Visual Studio 2017
- Kunal Chowdhury
- 103字
- 2021-07-15 17:26:43
Event attribute syntax
In XAML, you can also define events for a specific object element. Though it looks like property attribute, but is used to assign the event. If the attribute value of an element is the name of an event, it is treated as an event. In the following code snippet, the Click attribute defines the click event of the buttons:
<Button Click="Button_Click">Click Here</Button> <Button Click="Button_Click" Content="Click Here" />
The implementation of the event handler is generally defined in the code behind of the XAML page. The event implementation for the preceding button click event looks like this:
void Button_Click(object sender, RoutedEventArgs e) { // event implementation }
推薦閱讀
- Bootstrap Site Blueprints Volume II
- 一步一步學Spring Boot 2:微服務項目實戰
- Mobile Application Development:JavaScript Frameworks
- 程序設計與實踐(VB.NET)
- 深入淺出Spring Boot 2.x
- Web Development with Django Cookbook
- 精通軟件性能測試與LoadRunner實戰(第2版)
- 青少年Python編程入門
- Go并發編程實戰
- Mastering React
- 區塊鏈架構之美:從比特幣、以太坊、超級賬本看區塊鏈架構設計
- Getting Started with Python
- C語言程序設計
- Mastering Leap Motion
- Isomorphic Go