title: Injection and parameterless constructor in WPF
body: <p>I have code for user control in WPF (below). I use nInject as IocContainer. I initialize ioc in OnStartup event in my App class.</p>
  
  <pre><code>    protected override void OnStartup(StartupEventArgs e)
      {
          base.OnStartup(e);
  
          var iocContainer = IocContainer.Get();
  
          iocContainer.Bind&lt;CreateRemindPopup&gt;().To&lt;CreateRemindPopup&gt;();
          iocContainer.Bind&lt;MainWindow&gt;().To&lt;MainWindow&gt;();
  
          Current.MainWindow = iocContainer.Get&lt;MainWindow&gt;();
          Current.MainWindow.Show();
      }
  </code></pre>
  
  <p>If I remove parameterless constructor I get exception NullReferenceException when control should be displayed. When parameterless constructor is present code for display content is not executed.</p>
  
  <p>My question is how can I force WPF to execute constructor with parameter?
  I don't want to remove parameterless constructor, becouse then I lost designer in VisualStudio.</p>
  
  <pre><code>public partial class RemindersListing : UserControl
  {
      private readonly IReminderReadLogic _reminderReadLogic;
  
      public ObservableCollection&lt;Reminder&gt; Reminders { get; set; }
  
      public RemindersListing()
      {
      }
  
      public RemindersListing(IReminderReadLogic reminderReadLogic)
      {
          _reminderReadLogic = reminderReadLogic;
          InitializeComponent();
  
          var list = _reminderReadLogic.Get();
          Reminders = new ObservableCollection&lt;Reminder&gt;(list);
      }
  }
  </code></pre>