title: How to handle events with MVC Pattern in C#
body: <p>I'm implementing a mini program in C# using the MVC Architectural Pattern. The goal of this program is to update the value of a mouse click counter (which is in the Model), by clicking a button (which is in the View) through a Controller that must handle the Button Click Event.</p>
  
  <p>The code I've written so far works (it compiles without errors), but if fails to handle the button click event because I can't figure out what kind of code I must put into the View and what into the Controller. The only solution I tried and found working is to give the View a reference to its Controller. In this way, the Event Handler is registered and implemented in the View and it invokes a method of the Controller (e.g. Controller.DoSomethingOnButtonClick()). But this solution breaks the MVC Pattern, because the View, as far as I understood, should NOT be aware of its Controller.</p>
  
  <p>The Model (implements the Observer Pattern, it is the "observable"):</p>
  
  <pre><code>class Model : Subject
  {
     private int counter = 0;
  
     public void IncreaseCounterByOne()
     {
        counter++;
        Notify(); // notify the observers
     }
  
     public int GetCounter()
     {
        return counter;
     }
  }
  </code></pre>
  
  <p>The View (implements the Observer Pattern, it is the "observer"):</p>
  
  <pre><code>class View : IObserver
  {
      private Model Model;
      private Form MyForm = new Form();
      private Label MyLabel = new Label();
      private Button MyButton = new Button();
  
      public View(Model model)
      {
          this.Model = model;
          this.Model.Attach(this);
      }
  
      public void CreateView()
      {
          // create and display the view (MyForm, MyLabel, MyButton)
      }
  
      public void Update(Subject subject)
      {
          UpdateLabel();
      }
  
      private void UpdateLabel()
      {
          MyLabel.Text = "Click Counter: " + Model.GetCounter();
      }
  }
  </code></pre>
  
  <p>The Controller:</p>
  
  <pre><code>class Controller
  {
      private Model Model;
      private View View;
  
      public Controller(Model model, View view)
      {
          this.Model = model;
          this.View = view;
  
          this.View.CreateView();
      }
  
      private void UpdateCounter()
      {
          this.Model.IncreaseCounterByOne();
      }
  }
  </code></pre>
  
  <p>What I want to achieve is that the Controller catch the Button Click Event generated by MyButton and handle it in its Event Handler, which I assume to be something like:</p>
  
  <pre><code>public void OnButtonClicked(object sender, EventArgs e)
  {
      UpdateCounter();
  }
  </code></pre>
  
  <p>How can I accomplish this without using a reference to the Controller? Is it possible?</p>
  
  <p>PS. I already read a lot of similar questions, but not found the solution I'm looking for.</p>