I have a WinForms user control when I have hidden Control.Click using
public new event EventHandler Click
{
add
{
base.Click += value;
foreach (Control control in Controls)
{
control.Click += value;
}
}
...
}
(see this question). This works well and all is fine and dandy, until I cast it to a generic Control
(for example when passing a reference to something that knows nothing about the specific user control type).
In this case, when adding a click handler it is bound to the base Control_Click, completely bypassing the above method that was supposed to hide the base method. Any suggestions?