[英]Prism 4/Silverlight 4/MEF - Region not found
我只是在學習PRISM,所以可能這是一個非常簡單的錯誤:我正在嘗試以“樣式”定義Region,但找不到它們:( :(
在“殼”主窗口上,我具有包含“框架”對象的“ 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:
<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>
...
...
好-現在我在此頁面上找到了答案: Prism v4中DataTemplates內部的區域使用區域行為
實際上,根據本文,這是PRISM中的一個已知錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.