Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: View is not showing in region

$
0
0
Hi,

Based on my understanding, foreach statements should not modify the collection which is being iterated, since that could end up in an unexpected behaviour. For that reason, I think that a possible solution could be copying the views from viewcoll to another collection and then use that copied collection to iterate instead of viewcoll.

Finally, you should use the Activate method from the regionmgr instead of RegisterViewWithRegion with your PatientRegistration view (if the view is present in the region), or the Add method if you need to inject a new PatientRegistration view:
if (viewcoll.Count == 0)
{
      regionmgr.Regions["contentRegion"].Add(ServiceLocator.Current.GetInstance<PatientRegistration>());
}

regionmgr.Regions["contentRegion"].Activate(viewcoll.FirstOrDefault());
I hope you find this useful,

Federico Martinez
http://blogs.southworks.net/fmartinez

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>