- 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 }
推薦閱讀
- 三維圖形化C++趣味編程
- C++ 從入門到項目實踐(超值版)
- PLC編程與調試技術(松下系列)
- Oracle從入門到精通(第5版)
- Mastering Business Intelligence with MicroStrategy
- Julia for Data Science
- Visual Studio 2015高級編程(第6版)
- Microsoft 365 Certified Fundamentals MS-900 Exam Guide
- 零基礎學C語言程序設計
- 后臺開發:核心技術與應用實踐
- Julia數據科學應用
- INSTANT Apache ServiceMix How-to
- 超好玩的Scratch 3.5少兒編程
- Kotlin進階實戰
- PhantomJS Cookbook