区域内的区域棱镜未添加到区域管理器中



我有一个包含3个区域的Shell。其中之一(A)是加载包含内部区域(B)的视图。问题是区域B没有被添加到区域管理器中。因此,当我想加载区域B内的任何视图时,我会得到以下错误:区域管理器不包含ListRegion区域
这是常见问题还是我做错了什么?

编辑:添加的代码片段

<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>

感谢您的帮助,我发现我正在请求RegionManager在ViewModel构造函数的ListRegion中加载视图(此时视图尚未加载)。这就是我犯这个错误的原因。问题已解决

相关内容

  • 没有找到相关文章

最新更新