Events in Windows Presentation Foundation
page 3 of 5
by Keyvan Nayyeri
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 27598/ 123

Event Argument

Event handlers in Windows Presentation Foundation are very similar to handlers in traditional Windows Forms.  An object as sender and an event argument object are two parameters which form the typical signature for event handlers.

Each event handler has some information about the specific event type that it represents so you can use it in your code to accomplish several tasks and get helpful information about the event and the element that has received the event.  Properties for each event argument type may vary from one another but some properties are common between event arguments.

Here I give a list of eight event argument types with a description about the purpose and usage of each one.

·         RoutedEventArgs: This event argument type is a base type for some other argument types.  RoutedEventArgs, Itself, is the argument type that will be passed to some events like Click and Close.

·         KeyEventArgs: An event argument type for key events such as KeyUp or KeyDown.

·         MouseEventArgs: An event argument type to work with the mouse and its events.  Generally it's useful when you want to work with mouse states.

·         MouseButtonEventArgs: An extension of MouseEventArgs which adds some functionality to work with mouse button events.

·         TextChangedEventArgs: An event argument which provides properties for the TextChanged event.  It's inherited from RoutedEventArgs.

·         SelectionChangedEventArgs: An event argument which provides properties for SelectionChanged event.  It's inherited from RoutedEventArgs.

·         ScrollChangedEventArgs: An event argument which provides properties for working with scrollbar events.  It's inherited from RoutedEventArgs.

·         DependencyPropertyChangedEventArgs: This event argument is passed to events when a dependency property is changed.


View Entire Article

User Comments

Title: Easy to learn   
Name: Niranjan
Date: 2009-11-29 9:05:16 PM
Comment:
Thanks for the efforts. The article is simple to understand.Great efforts.
Title: Excellent   
Name: shaukat
Date: 2007-06-29 3:50:54 AM
Comment:
Excllent
Title: Thanks   
Name: Keyvan Nayyeri
Date: 2007-01-15 11:38:12 PM
Comment:
Thanks Sam,

But if I can remember correctly, MSDN Wiki wasn't available when I wrote the first part of these tutorials to add it to introduction article because it was before RC days.

However, it was better to leave this comment there but thank you for sharing it with others.
Title: Need link to WPF Online SDK part 2   
Name: Sam
Date: 2007-01-15 8:01:50 PM
Comment:
Oops, posting another comment 'cause the URL didn't render. Here it is: http://msdn2.microsoft.com/en-us/library/ms754130.aspx
Title: Need a link to online WPF SDK   
Name: Sam
Date: 2007-01-15 8:00:01 PM
Comment:
There are a ton of WPF articles that would help newbies and experienced alike. Please add a link to that page so people know where to go next.
Title: Thanxٍ   
Name: Behnam Usefi
Date: 2006-12-30 2:00:31 AM
Comment:
Thanx K1
Title: Thanks   
Name: Keyvan Nayyeri
Date: 2006-12-14 11:02:58 AM
Comment:
Thanks Mohammad,

I tried to cover fundamental concepts for those who only want to have a background but surely you need a book if you want to work professionally on WPF and XAML.

Thanks again :-)
Title: Another great article !!!   
Name: AzamSharp
Date: 2006-12-14 10:59:42 AM
Comment:
Another great article! Why buy a book when I can read this great series. :)

Thanks and plus thanks for posting all the links that really helps!
Title: Animations in XAML   
Name: Keyvan Nayyeri
Date: 2006-12-14 10:21:22 AM
Comment:
Fourth part of these tutorials about Animations in XAML:
http://aspalliance.com/1050_Animations_in_XAML
Title: Resources in XAML   
Name: Keyvan Nayyeri
Date: 2006-12-14 10:20:23 AM
Comment:
Third part of these tutorials about Resources in XAML:
http://aspalliance.com/1032_Resources_in_XAML
Title: Layout in XAML   
Name: Keyvan Nayyeri
Date: 2006-12-14 10:18:22 AM
Comment:
Second part of these tutorials about Layout in XAML:
http://aspalliance.com/1023_Layout_in_XAML
Title: Introduction to XAML   
Name: Keyvan Nayyeri
Date: 2006-12-14 10:17:27 AM
Comment:
First part of these tutorials, Introduction to XAML:
http://aspalliance.com/1019_Introduction_to_XAML






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-02-22 4:45:00 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search