【问题标题】:Prism 4/Silverlight 4/MEF - Region not foundPrism 4/Silverlight 4/MEF - 未找到区域
【发布时间】:2012-02-05 15:00:05
【问题描述】:

我只是在学习 PRISM,所以这可能是一个非常简单的错误:我正在尝试以“样式”定义区域,但他们没有找到 :( :(

在主“Shell”窗口中,我有包含“Frame”对象的“ContentControl”。在附加的 ResourceDictionary 中设置样式的“ContentControl”以及在那里定义的所有区域(带有额外的颜色、画笔、按钮、网格等......)但是每当程序运行(所有正确显示在屏幕上)时,IRegionManager.Regions 都是空集合...... .

我可以做些什么来使用“样式”中的区域???

这是代码:

Shell.xaml

<UserControl x:Class="CardManagment.Shell"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
             d:DesignHeight="300"
             d:DesignWidth="400"
             mc:Ignorable="d">
    <ContentControl HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch"
                    Style="{StaticResource MainWindowStyle}">
        <sdk:Frame x:Name="MainFrame"
                   HorizontalAlignment="Stretch"
                   VerticalAlignment="Stretch"
                   BorderBrush="#FFFB0000"
                   Style="{StaticResource GlobalNavigationFrameStyle}"
                   UriMapper="{StaticResource GlobalUriMapper}" />
    </ContentControl>
</UserControl>

和资源字典:

     <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Regions;assembly=Microsoft.Practices.Prism" 
        xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">
            <Style x:Key="MainWindowStyle" TargetType="ContentControl">
                <Setter Property="Foreground" Value="#FF000000"/>
                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                <Setter Property="VerticalContentAlignment" Value="Top"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ContentControl">
    ...
    ...
    ...
    <Border Grid.Row="1" BorderThickness="2" CornerRadius="2" BorderBrush="#FFDC1EBA">
        <ContentControl x:Name="GlobalLogoRegion" prism:RegionManager.RegionName="GlobalLogoRegion" />
    </Border>
...
...

【问题讨论】:

    标签: silverlight prism


    【解决方案1】:

    好的 - 现在我在这个页面上找到了答案:Regions inside DataTemplates in Prism v4 using a region behavior

    根据这篇文章,实际上这是 PRISM 中的一个已知错误。

    【讨论】:

      猜你喜欢
      • 2011-09-25
      • 2011-05-03
      • 2011-07-01
      • 1970-01-01
      • 2013-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多