自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

WPF事件注冊特點介紹

開發(fā) 開發(fā)工具
在WPF中,WPF事件注冊的參數(shù)和以往有些不太相同,它的參數(shù)變?yōu)镽outedEventArgs。我們以一段代碼示例來講解,方便大家理解。

WPF注冊事件是一個比較基礎的知識點。對于初學者來說,掌握這一技巧的應用,是非常有必要的。在這里我們就來具體的了解一下相關知識。#t#

WPF事件注冊與以往的有些區(qū)別,事件的參數(shù)變?yōu)椋篟outedEventArgs。

示例:XAML端代碼:

 

  1. Window x:Class="Hello.Window1" 
  2. xmlns="http://schemas.microsoft
    .com/winfx/2006/xaml/presentation"
     
  3. xmlns:x="http://schemas.microsoft.
    com/winfx/2006/xaml"
     
  4. Title="Hello" Height="300" 
    Width="300" 
  5. > 
  6. < Grid> 
  7. < Button Height="23" Margin="12,52,0,0" 
    Name="btnOK" VerticalAlignment="Top"
     HorizontalAlignment="Left" Width="75" 
    Click="btnOK_Click" >確定< /Button> 
  8. < TextBox Height="26" Margin=
    "105,51,87,0" Name="txtHello" 
    VerticalAlignment="Top" >< /TextBox> 
  9. < /Grid> 
  10. < /Window> 

 

后臺關聯(lián)的C#代碼如下:

 

  1. using System;  
  2. using System.Windows;  
  3. namespace Hello  
  4. ...{  
  5. /**//// < summary> 
  6. /// Interaction logic 
    for Window1.xaml  
  7. /// < /summary> 
  8. public partial class 
    Window1 : System.Windows.Window  
  9. ...{  
  10. public Window1()  
  11. ...{  
  12. InitializeComponent();  
  13. //btnOK.Click += new 
    RoutedEventHandler(SetText);  
  14. }  
  15. public void btnOK_Click(object 
    sender, RoutedEventArgs e)  
  16. ...{  
  17. txtHello.Text = "Hello World!";  
  18. }  
  19. }  

以上就是WPF事件注冊的一些具體介紹,希望對大家有用。

責任編輯:曹凱 來源: CSDN
相關推薦

2009-12-29 13:29:28

WPF Depende

2009-12-23 16:06:46

WPF事件策略

2009-12-25 16:05:24

WPF 4.0特點

2009-12-28 11:41:04

WPF 3.5特點

2009-12-24 15:53:19

WPF API

2009-12-24 17:38:18

WPF事件觸發(fā)器

2009-12-14 13:56:12

Ruby特點

2010-01-27 16:41:48

Android特點

2009-12-25 10:05:06

WPF資源

2009-12-24 14:18:57

WPF類型轉(zhuǎn)換

2009-12-25 11:04:51

WPF Border

2009-12-23 18:06:25

WPF模板

2010-03-10 18:51:18

Python語言

2010-02-23 09:51:32

WCF MTOM

2009-12-14 18:30:59

Ruby DSL特點

2009-12-28 13:23:19

WPF導出圖片

2009-12-25 09:34:50

WPF顯示HTML

2009-12-29 10:32:24

WPF Listbox

2009-12-23 14:11:05

WPF名字空間

2009-12-28 11:14:29

WPF顯示文本
點贊
收藏

51CTO技術棧公眾號