简体   繁体   中英

Region inside a region Prism not added to region manager

I have a Shell contains 3 regions. One of those(A) is loading a view that contains a region(B) inside. the problem is the region B is not added to the region manager. so when I want to load any view inside region B i get this error : The region manager does not contain the ListRegion region .
Is it a common issue or am I doing something wrong ?

Edit : Code snippet added

<UserControl x:Class="StockOutput.Views.OutputInvoice"
             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" 
             xmlns:glob="clr-namespace:System.Globalization;assembly=mscorlib"
             xmlns:ext="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended"
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             xmlns:gs="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
             xmlns:prism="http://www.codeplex.com/prism"
             xmlns:inf="clr-namespace:SmartStock.Infrastructure;assembly=SmartStock.Infrastructure"
             xmlns:View="clr-namespace:Tiers.Views;assembly=Tiers"
             >
    <Grid >
... 
 <ext:ChildWindow  WindowStartupLocation="Center" CloseButtonVisibility="Hidden" Height="350" Width="600" WindowState="{Binding SupplierSelectionWindow}" IsModal="True" Grid.RowSpan="3" Grid.ColumnSpan="2">
            <ext:ChildWindow.Resources>

            </ext:ChildWindow.Resources>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="75*"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="35"></RowDefinition>
                </Grid.RowDefinitions>
                <Label Style="{StaticResource ViewTitle}">Choix Tièrs</Label>
                <StackPanel Orientation="Horizontal" Grid.Row="1">
                    <Label Margin="5">Recherche :</Label>
                    <TextBox TabIndex="0" Margin="5" Width="150"></TextBox>
                </StackPanel>

//HERE IS MY REGION
                <ContentControl Margin="5" Grid.Row="2"  prism:RegionManager.RegionName="{x:Static inf:RegionNames.ListRegion}">

                </ContentControl>
                <!-- <DataGrid Margin="5" TabIndex="1" Grid.Row="2" ItemsSource="{Binding TiersList}" SelectedItem="{Binding SelectedTiers}" CanUserAddRows="True" IsReadOnly="False">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Fournisseur" Binding="{Binding TiersName}"></DataGridTextColumn>
                        <DataGridTextColumn Header="Catégorie" Binding="{Binding OperartorCategories.OperatorCategoryName}"></DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>-->
                <Button Grid.Row="3" TabIndex="2" Width="120" Margin="5" HorizontalAlignment="Right" Command="{Binding ValidateTiersChoiceCommand}">Valider</Button>
                <Button Command="{Binding CancelChoiceCommand}" Margin="0,5,144,5" Content="Annuler" HorizontalAlignment="Right" TabIndex="3" Width="120" Grid.Row="3" />
            </Grid>
        </ext:ChildWindow>
        ...
    </Grid>
</UserControl>

Thanks for your help, I found that I'm asking the RegionManager to load a view in ListRegion at the ViewModel constructor (at this time the View didn't load yet). That's why I got this error. Problem solved

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM