title: UserControl Inheritance WPF
body: <p>I wanted to implement a base class for my views. This class looks like the following:</p>
  
  <pre><code>public abstract class ViewBase&lt;T&gt; : UserControl, IView where T : ViewModelBase 
  {
      protected ViewModelBase viewModel;
  
      public ViewBase(T viewModel) : base()
      {
          this.InitializeComponent();
  
          this.viewModel = viewModel;
          this.DataContext = viewModel;
      }
  
      protected abstract void InitializeComponent();
  
      public void OnViewCalled(object parameters)
      {
          this.viewModel.OnCalled(parameters);
      }
  }
  </code></pre>
  
  <p>This is the usage of the base class:</p>
  
  <pre><code>public sealed partial class LoginView : ViewBase&lt;LoginViewModel&gt;
  {
      public LoginView(LoginViewModel viewModel) : base(viewModel)
      { 
      }
  }
  </code></pre>
  
  <p>The problem is that when I try the above code, I get the following error:</p>
  
  <blockquote>
    <p>CS1729  C# 'UserControl' does not contain a constructor that takes 1
    arguments</p>
  </blockquote>
  
  <p>Why is not the constructor of the <code>ViewBase</code> class called?</p>