Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Based on my understanding, <strong>Prism</strong> loads and show by default the first <strong>View</strong> that gets registered on each <strong>Region</strong> (Only the first <strong>View</strong> would be shown if the region is set on a <strong>ContentControl</strong> item).</p> <p>Therefore, you could <em>deactivate</em> the undesired <strong>Views</strong> on each <strong>RegionBehavior</strong> you don't want to show at startUp. This would make that when the desired <strong><em>StartUp View</em></strong> is added, it would get <em>activated</em> as there is no other <em>active</em> <strong>View</strong> yet. </p> <p>Another alternative would be to register each <strong>View</strong> on the corresponding <strong>Module</strong> <em>initialize()</em> method, instead of using <strong>RegionBehaviours</strong>. So finally, after adding each <strong>View</strong> to the corresponding <strong>Region</strong>, you would decide to <em>deactivate</em> the <strong>View</strong> whether it is the <strong><em>StartUp View</em></strong> or not.</p> <p><strong>UPDATE:</strong></p> <p>The following implementation shows a possible alternative for <strong><em>deactivating</em></strong> non-startup <strong>Views</strong> on each <strong>RegionBehavior</strong>. In order to get a more elegant solution, you could create a dictionary or a simple static class that would return the <strong>StartUpView</strong> name for the corresponding <strong>Region</strong>, and then call it as shown below:</p> <pre><code>private void AddRegisteredViews() { ... var view = viewEntry.Value; if (!Region.Views.Contains(view)) { Region.Add(view); if (view.GetType().Name != StartUpViewNames.getViewNameFromRegion(Region)) { Region.deactivate(view); } } ... } </code></pre> <p>Notice that I after the <strong>StartUpView</strong> is found and it is kept <em>active</em>, it continues deactivating the following added <strong>views</strong>, but you could leave them <em>active</em>. As I mentioned, the <strong>View</strong> that would be shown, would be the first one which gets <em>Active</em> in the <strong>Region</strong>.</p> <p>I hope this helps, Regards.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload