Ando
Ando

Reputation: 11409

Silverlight 5 + Prism:TabControlRegionAdapter

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?

Upvotes: 2

Views: 2113

Answers (1)

lalsteris
lalsteris

Reputation: 21

I had the same issue. I put the tab style into the resources section of the xaml and used the following code-behind:

TabControlRegionAdapter.SetItemContainerStyle(TabControl1, Resources["TabControl1ItemStyle"] as Style);

Upvotes: 2

Related Questions