我有一个 Shell 包含 3 个区域。其中之一(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>