- 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 }
推薦閱讀
- Cocos2d Cross-Platform Game Development Cookbook(Second Edition)
- JavaScript+jQuery網頁特效設計任務驅動教程(第2版)
- arc42 by Example
- HTML5+CSS3基礎開發教程(第2版)
- Network Automation Cookbook
- 數據結構(Java語言描述)
- Python金融數據分析
- 你不知道的JavaScript(中卷)
- 大學計算機基礎(第2版)(微課版)
- Learning Probabilistic Graphical Models in R
- Red Hat Enterprise Linux Troubleshooting Guide
- Programming Microsoft Dynamics? NAV 2015
- Oracle Database XE 11gR2 Jump Start Guide
- C/C++代碼調試的藝術(第2版)
- Laravel Design Patterns and Best Practices