0
votes

The simple view is a child of a Dragablz Tab and is defined as follows:

UserControl x:Class="Esc.Eris.Apps.Dashboards.Views.DashboardViewer"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         mc:Ignorable="d" 
         d:DesignHeight="450" d:DesignWidth="800"
         xmlns:prism="http://prismlibrary.com/"
         prism:ViewModelLocator.AutoWireViewModel="True">
        <Grid>
            <ContentControl prism:RegionManager.RegionName="DashboardViewerContentRegion" />
        </Grid>
</UserControl>

With a breakpoint set in the ViewModel constructor, I can examine the contents of the IRegionManager regionManager injected parameter, but the regionManager contains no regions.

I thought that the prism:RegionManager.RegionName= declaration in the view automatically registered the region with the regionManager, but obviously not.

This is not my first Prism app, but this is the first time I have seen this behavior.

The module containing this view was added to the moduleCatalog via the ConfigureModuleCatalog in the App.xaml.cs file.

Can someone explain what is happening here?

Thanks in advance!

1

1 Answers

0
votes

After doing a lot of SO research, I added a RegionManager.SetRegionManager call in the View constructor. Without the SetRegionManager function call, no region is ever added to the regionManager.Regions collection. I also added an Event Interaction Trigger declaration for the view "Loaded" event in the view xaml. This trigger invokes a ViewLoaded command in the view model which fires off a 5 second time constrained task that checks the regionManager Regions collection for any registered regions from the view. Interestingly enough, it takes almost 30ms for the view region to appear in the regionManager.Regions collection in the view model, and then at that point, I can populate the region via a RequestNavigate function call.

Normally with Prism, I never need to do any of this.

The view is a child of a Dragablz Tab, and I can only guess that it is the Dragablz environment that is requiring me to jump through the extra hoops to register the view region .... but that is pure conjecture on my part.