0

I have a really strange problem with PRISM 6 and NavBarControl / NavBarGroup.

I have the following in my Shell.xaml

        <dxn:NavBarControl MaxWidth="250" DockPanel.Dock="Left">
            <dxn:NavBarControl.View>
                <dxn:ExplorerBarView />
            </dxn:NavBarControl.View>

            <dxn:NavBarGroup prism:RegionManager.RegionName="Business" Header="Business" />
            <dxn:NavBarGroup prism:RegionManager.RegionName="Reports" Header="Reports" />
            <dxn:NavBarGroup prism:RegionManager.RegionName="Administration" Header="Administration" />

        </dxn:NavBarControl>

I create a custom RegionAdapter for the NavBarGroup. The method that needs to be implemented CreateRegion returns a new AllActiveRegion(). This method only gets hit twice and returns a new region for Reports and Administration.

The first region named Business is missing. If I add a new group at the beginning then that region is missing and the next one is added...

Any ideas what i could do?

Thanks for the help...

4

1 回答 1

0

As NavBarGroup is not a visual element (it is inherited from the FrameworkContentElement class), the issue may be related to the DelayedRegionCreationBehavior garbage collected in non-FrameworkElement regions issue in PRISM. You can try to modify PRISM classes as shown in that report or assign region names in code as we did at Prism Region in ribbon stops working after adding DockLayoutManager.

I went with the secont approach of setting the regions in code behind of my Shell.xaml. This worked well and the regions get populated the correct way.

Shell.xaml.cs (ctor)

RegionManager.SetRegionName(business, "Business");
RegionManager.SetRegionName(reports, "Reports");
RegionManager.SetRegionName(administration, "Administration");
于 2016-10-10T16:32:00.217 回答