title: What's the difference between the two RegisterViewWithRegion overloads in Prism
body: <p>I'm using Prism4 and in one of my modules I'm trying to register a view with a region and also handle its button clicked event (which is published when user clicks on a button on the view).</p>
  <pre><code>public class MyModule : IModule
  {
      private readonly IUnityContainer container;
      private readonly IRegionManager regionManager;
      private readonly IEventAggregator eventAggregator;
  
      public MyModule(IUnityContainer container, IRegionManager regionManager, IEventAggregator eventAggregator)
      {
          this.container     = container;
          this.regionManager = regionManager;
          this.eventAggregator = eventAggregator;
  
          eventAggregator.GetEvent&lt;ViewAButtonClicked&gt;().Subscribe(ViewAButtonClicked);
      }
  
      public void Initialize()
      {
          this.regionManager.RegisterViewWithRegion(&quot;MainRegion&quot;, typeof(ViewA));
          
          // this 2nd overload would work fine
          //this.regionManager.RegisterViewWithRegion(&quot;MainRegion&quot;, () =&gt; this.container.Resolve&lt;ViewA&gt;());            
      }
  
      public void ViewAButtonClicked()
      {
         // some handling code 
         // does *NOT* execute if using the 1st RegisterViewWithRegion overload
         // executes if using the 2nd RegisterViewWithRegion overload
      }
  }
  </code></pre>
  <p>The above code works fine up except that it does not execute the ViewAButtonClicked method.</p>
  <p>If I switched to use the other overload (commented out in code above) then everything works as expected, the ButtonClicked method runs.</p>
  <p>The descriptions from msdn are very similar and I'm not sure why it's giving me the different behavior described above. Why does one work and one doesn't when it comes to handling the button click event?</p>
  <blockquote>
  <p>RegisterViewWithRegion(IRegionManager, String, Func&lt;(Of &lt;(Object&gt;)&gt;)):
  Associate a view with a region, using a delegate to resolve a concreate instance of the ? view. When the region get's displayed, this delelgate will be called and the result will be added to the views collection of the region.</p>
  <p>RegisterViewWithRegion(IRegionManager, String, Type):
  Associate a view with a region, by registering a type. When the region get's displayed this type will be resolved using the ServiceLocator into a concrete instance. The instance will be added to the Views collection of the region.</p>
  </blockquote>