棱镜和区域
0嗨,
我有一个 shell,其中设置了一个区域“MainContentRegion”。在该区域中,我加载此视图:
<UserControl x:Class="CustomControls.MainContent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="http://www.codeplex.com/CompositeWPF">
<Border BorderThickness="1" BorderBrush="Black" Margin="2">
<Grid x:Name="ContentGrid" Background="{StaticResource MainContentBackgroundColor}">
<Grid.RowDefinitions>
<RowDefinition Height="55" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ContentControl Name="MainContentHeaderRegion" cal:RegionManager.RegionName="MainContentHeaderRegion" Grid.Row="1"/>
<ContentControl Name="MainContentBodyRegion" cal:RegionManager.RegionName="MainContentBodyRegion" Grid.Row="2"/>
</Grid>
</Border>
</UserControl>
当尝试访问 2 个新添加的区域时,我收到错误,在查找加载的区域后,我只看到从 shell 添加的区域。有人可以帮忙吗?
0Hi
I have a shell in which i have a region "MainContentRegion" set. In that region i load this view:
<UserControl x:Class="CustomControls.MainContent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cal="http://www.codeplex.com/CompositeWPF">
<Border BorderThickness="1" BorderBrush="Black" Margin="2">
<Grid x:Name="ContentGrid" Background="{StaticResource MainContentBackgroundColor}">
<Grid.RowDefinitions>
<RowDefinition Height="55" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ContentControl Name="MainContentHeaderRegion" cal:RegionManager.RegionName="MainContentHeaderRegion" Grid.Row="1"/>
<ContentControl Name="MainContentBodyRegion" cal:RegionManager.RegionName="MainContentBodyRegion" Grid.Row="2"/>
</Grid>
</Border>
</UserControl>
When trying to access the 2 new added regions i get an error and after looking up the loaded regions i only see the regions added from the shell. Can someone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果包含嵌套区域的视图被加载多次,可能会导致错误,因为嵌套区域将不再是唯一的 - 在这种情况下,您应该使用作用域区域 - 请参阅 doc
If the view containing the nested regions is loaded more than once that could cause an error as the nested regions would no longer be unique - in which case you should use a scoped region - see doc