Questions tagged [eventargs]

Represents the base class for classes that contain event data, and provides a value to use for events that do not include event data.

Represents the base class for classes that contain event data, and provides a value to use for events that do not include event data.

This class serves as the base class for all classes that represent event data. For example, the System.AssemblyLoadEventArgs class derives from EventArgs and is used to hold the data for assembly load events. To create a custom event data class, create a class that derives from the EventArgs class and provide the properties to store the necessary data. The name of your custom event data class should end with EventArgs.

http://msdn.microsoft.com/en-us/library/system.eventargs(v=vs.110).aspx

164 questions
92
votes
7 answers

Does .NET have a built-in EventArgs?

I am getting ready to create a generic EventArgs class for event args that carry a single argument: public class EventArg : EventArgs { // Property variable private readonly T p_EventData; // Constructor public EventArg(T data) …
David Veeneman
  • 18,912
  • 32
  • 122
  • 187
75
votes
13 answers

MVVM Passing EventArgs As Command Parameter

I'm using Microsoft Expression Blend 4 I have a Browser .., [ XAML ] ConnectionView " Empty Code Behind "
Ahmed Ghoneim
  • 6,834
  • 9
  • 49
  • 79
73
votes
6 answers

Why use EventArgs.Empty instead of null?

I recall reading, on multiple occasions and in multiple locations, that when firing the typical event: protected virtual OnSomethingHappened() { this.SomethingHappened(this, EventArgs.Empty); } e should be EventArgs.Empty if there are no…
Greg D
  • 43,259
  • 14
  • 84
  • 117
64
votes
2 answers

What is the use of "object sender" and "EventArgs e" parameters?

In case of Page_Load, Init and other page events, what is the use of these (object sender, EventArgs e) parameters? Examples would be more helpful.
Qasim
  • 681
  • 1
  • 6
  • 6
50
votes
7 answers

How do I make an eventhandler run asynchronously?

I am writing a Visual C# program that executes a continuous loop of operations on a secondary thread. Occasionally when that thread finishes a task I want it to trigger an eventhandler. My program does that but the when the event handler is…
PICyourBrain
  • 9,976
  • 26
  • 91
  • 136
41
votes
5 answers

How do I pass objects in EventArgs

I have a usercontrol that raises an event after communicating with a web service. The parent handles this event when raised. What I thought would be the proper approach would be to pass the object returned from the webservice to the parent as…
GPGVM
  • 5,515
  • 10
  • 56
  • 97
27
votes
3 answers

Using EventArgs to pass information back to invoking class

Is it frowned upon to modify EventArgs in event handlers for the purpose of passing information back to the class invoking the event? For instance, if I have a low-level communication class needing to validate a certificate for SSL but it has no way…
r_ahlskog
  • 1,916
  • 1
  • 17
  • 26
23
votes
3 answers

asp.net :how to use eventargs for parameter passing on button onclick?

i have seen some code in which people pass parameter through commandParameter Property of web control.then what is use of eventargs.
Maddy.Shik
  • 6,609
  • 18
  • 69
  • 98
21
votes
3 answers

Why to not use a custom class instead of inheriting the EventArgs class

I'm wondering why should I use a class that inherits from the EventArgs class instead of using a custom class that will do the same job for me when passing event data?
Yair Nevet
  • 12,725
  • 14
  • 66
  • 108
19
votes
4 answers

Are EventArg classes needed now that we have generics

With generics, is there ever a reason to create specific derived EventArg classes It seems like now you can simply use them on the fly with a generic implementation. Should i go thorugh all of my examples and remove my eventArg classes…
leora
  • 188,729
  • 360
  • 878
  • 1,366
17
votes
1 answer

Why does CompositionTarget.Rendering take EventArgs instead of RenderingEventArgs?

The CompositionTarget.Rendering event is a plain old EventHandler, with a plain old EventArgs. However, in real life, it apparently always gets an instance of RenderingEventArgs. So your event handler has to start by casting the EventArgs in order…
Joe White
  • 94,807
  • 60
  • 220
  • 330
15
votes
3 answers

How wrong is it to create an event handler delegate with out the standard (Obj sender, EventArgs args) signature?

I understand the benefits of using the standard MS event handler delegate signature as it allows you to easily expand on the information passed through the event with out breaking any old relationships that are based on the old delegate…
Eric Anastas
  • 21,675
  • 38
  • 142
  • 236
13
votes
1 answer

What's the purpose of EventArgs as base class in the event pattern?

The classic general C# event has these parameters: (object sender, EventArgs e) I can implement an event with a more specific signature for the e argument, deriving for EventArgs. Now, what's the purpose of a base class like EventArgs? I mean...…
Massimiliano Kraus
  • 3,638
  • 5
  • 27
  • 47
12
votes
2 answers

Pass object in click/tapped event handler in Xamarin Forms

Here is my job class: public class Job { public string Id{ get; set;} public string Name{ get; set;} } And here is my ListView: public class JobListePage:ContentPage { // Members private ListView lstView; …
arnie
  • 189
  • 4
  • 13
12
votes
1 answer

WPF: I don't understand class TextCompositionEventArgs

I don't understand the class TextCompositionEventArgs. There are members of type string named ControlText,SystemText,Text. Then there is a field TextConmposistion which itself contains the members ControlText, SystemText and Text again and…
codymanix
  • 28,510
  • 21
  • 92
  • 151
1
2 3
10 11