The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator 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());
SASameerMay 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());
>