2012-02-05 2 views
0

Я просто изучаю PRISM, так может быть, это очень простая ошибка: я пытаюсь определить Region в «Style», и они не нашли :(:(Prism 4/Silverlight 4/MEF - Регион не найден

В главном окне «Shell» у меня есть «ContentControl», который включает в себя объект «Frame». «ContentControl», созданный в прилагаемом ResourceDictionary и всех регионах, определенных там (с дополнительными цветами, кистями, кнопками, сетками и т. Д.). всякий раз, когда программа работает (все правильно отображается на экране) в 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:

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

ответ