We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Adding an event handler to the property page

Hello, I created a custom data grid, with custom table styles et al. I am exposing a event handling delegate as a property, so that the users may hook their own functions to add on to the paint methods. The Property does show up in the property page, however it wont allow me to add anything there. What I am basically asking is, How do I expose a delegate in the property page of a custom control? Thanks, -S

2 Replies

AD Administrator Syncfusion Team May 2, 2003 02:32 PM UTC

i hope this is what you are asking [Category("Property Changed")] public event EventHandler SelectedIndexChange; protected virtual void OnSelectedIndexChange(EventArgs e) { if (SelectedIndexChange != null) { // Invokes the delegates. SelectedIndexChange(this, e); } } and whereever you want to fire the event you put this.OnSelectedIndexChange(new EventArgs());


SA Sameer May 9, 2003 02:10 PM UTC

No, I will try explaining the problem again, maybe i am not sure what i really want ( that is always dangerous ) I have a custom control, which is a data grid. I have a delegate defined within the control, and i want the users to hook their own functions there. From ur example, when we have a combo box, and we need to handle some events, like the selected change, in the property sheet u would look up the event selected index changed and add ur own function there. Similarly I am exposing an event called CellPaint, and I need the user to add their own function. When I expose the delegate from within my control as a public property, it appears on the property sheet, but is uneditable. I am sorry if i am not too clear abt my question. i am still a newbie and pretty much learning the C# lingo thanks for your answer tough. -S > i hope this is what you are asking > > [Category("Property Changed")] > public event EventHandler SelectedIndexChange; > > protected virtual void OnSelectedIndexChange(EventArgs e) > { > if (SelectedIndexChange != null) > { > // Invokes the delegates. > SelectedIndexChange(this, e); > } > } > > and whereever you want to fire the event you put > this.OnSelectedIndexChange(new EventArgs()); >

Loader.
Live Chat Icon For mobile
Up arrow icon