title: Is there a way to programmatically bind an event to a method in Blazor?
body: <p>While the normal way of event binding is by using attributes in the markup, I'd like to automatically event bind. This would be great when there is a large number of instances the component. In my case I'd like to always call a CascadingParameter component in the OnClick the same way.</p>
  <p>Something like this:</p>
  <pre class="lang-cs prettyprint-override"><code>public class PrositThBase : ComponentBase
  {
      [Parameter]
      public RenderFragment ChildContent { get; set; }
  
      protected override async Task OnInitializedAsync()
      {
          OnClick += OnClick;
  
          base.OnInitializedAsync();
      }
  
      public void OnClick()
      {
  
      }
  }
  </code></pre>
  <p>But this does not work. Is there any way of accomplishing this?</p>