How to get an instance of the registered view in ContentRegistered?
I have the following code in one of my Modules :
public class MyModule : IModule { private IRegionManager mRegionManager { get; set; }
public MyModule开发者_JAVA百科 (IRegionManager regMan) { mRegionManager = regMan; IRegionViewRegistry ir = ServiceLocator.Current.GetInstance<IRegionViewRegistry>(); ir.ContentRegistered += new EventHandler<ViewRegisteredEventArgs>(ir_ContentRegistered); } void ir_ContentRegistered(object sender,ViewRegisteredEventArgs e) { // How get an instance of BaseTableView } public void Initialize() { mRegionManager.RegisterViewWithRegion("MainRegion",typeof(BaseTableView)); } }
How can i have an instance of BaseTableView in the ir_ContentRegistered event handler?
e.GetView()
http://msdn.microsoft.com/en-us/library/microsoft.practices.prism.regions.viewregisteredeventargs.getview(v=pandp.38).aspx
Note that GetView
is a property, that returns a Func<Object>
, which is then invoked: ()
.
精彩评论