locked
How to remove all handlers of a click event? (I don't know the names of the methods nor the handlers) RRS feed

  • Question

  • How to remove all handlers of a click event?
    Note:  I don´t know the names of the methods nor the handlers.

    Ex;

    //elemento is Button

    EventInfo evInfo = elemento.GetType().GetEvent("Click");
    evInfo.RemoveEventHandler(elemento, XXX);

    Where XXX = Delegate handler
    But, I don´t know who is "Delegate handler"......

    Thanks


    Wednesday, June 15, 2011 8:46 PM

All replies

  • Try doing:

    elemento.Click = null;
    


    I believe this clears all event handlers for the Click Event of a UI component.

     

    Regards,

    Fabian Fernandez


    Fabian Fernandez / .NET Developer / Montevideo, Uruguay.
    Wednesday, July 27, 2011 5:38 AM