- 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 }
推薦閱讀
- Mastering OpenLayers 3
- Extending Jenkins
- Google Flutter Mobile Development Quick Start Guide
- 解構產品經理:互聯網產品策劃入門寶典
- HTML5 移動Web開發從入門到精通(微課精編版)
- 跟小海龜學Python
- Python網絡爬蟲從入門到實踐(第2版)
- MySQL數據庫管理與開發實踐教程 (清華電腦學堂)
- C語言程序設計案例精粹
- 常用工具軟件立體化教程(微課版)
- Internet of Things with ESP8266
- Statistical Application Development with R and Python(Second Edition)
- Python 3.7從入門到精通(視頻教學版)
- Mastering Python Design Patterns
- Getting Started with Python