2

我有一个使用带有棱镜的 TabControl 的视图:TabControlRegionAdapter

 <sdk:TabControl Grid.Row="1" AutomationProperties.AutomationId="GUID" Margin="8,8,12,12"
                    prism:RegionManager.RegionName="GUID_REG_NAME"
                    prism:RegionManager.RegionContext="{Binding CurrentSelectedItem}" Name="TabControl1" >
        <prism:TabControlRegionAdapter.ItemContainerStyle>
            <Style TargetType="sdk:TabItem">
                <Setter Property="HeaderTemplate">
                    <Setter.Value>
                        <!--Display the child view name on the tab header-->
                        <DataTemplate>
                            <TextBlock Text="{Binding ViewName}" />
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </prism:TabControlRegionAdapter.ItemContainerStyle>
    </sdk:TabControl>

只要我以 Silverlight 4 为目标,一切都运行良好。

我得到了 Silverlight 5 beta 并将项目的目标版本更改为 SL 5。
现在视图不会编译错误:
The property 'ItemContainerStyle' does not exist on the type 'TabControl' in the XML namespace 'http://www.codeplex.com/prism'

其他人有这个错误吗?
关于原因/如何解决它的任何想法?

4

1 回答 1

2

我遇到过同样的问题。我将选项卡样式放入 xaml 的资源部分并使用以下代码隐藏:

TabControlRegionAdapter.SetItemContainerStyle(TabControl1, Resources["TabControl1ItemStyle"] as Style);
于 2011-07-11T01:30:45.457 回答