Silverlight 5 +棱镜:TabControlRegionAdapter
我有一个使用带有棱镜的 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。
现在视图将无法编译并出现错误:XML 命名空间“http://www.codeplex.com/prism”中的类型“TabControl”上不存在属性“ItemContainerStyle”
还有其他人遇到此错误吗?
关于原因/如何解决它有什么想法吗?
I had a View using a TabControl with a prism: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>
Everything worked fine as long as I targeted Silverlight 4.
I got the Silverlight 5 beta and changed the project's target version to SL 5.
Now the view won't compile with error:The property 'ItemContainerStyle' does not exist on the type 'TabControl' in the XML namespace 'http://www.codeplex.com/prism'
Anyone else got this error?
Any ideas about the causes/how to fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有同样的问题。我将选项卡样式放入 xaml 的资源部分并使用以下代码隐藏:
I had the same issue. I put the tab style into the resources section of the xaml and used the following code-behind: